'ProgramMode:RUN 'Maze Generator 'Made by ForAbby '2016 ' Port to C.Basic '2017 by sentaro21 ViewWindow 1,127,0,1,63,0,1,4,1 S-Gph1 DrawOn,xyLine,List 1,List 2,1,Dot S-Gph2 DrawOff S-Gph3 DrawOff CoordOff GridOff AxesOff LabelOff BG-None S-WindMan For 1->Z To 64 Step 4 #8+4*sin (Z*7) SketchNormal F-Line Z,34-Ans,Z,34+Ans SketchNormal F-Line 127-Z,34-Ans,127-Z,34+Ans Next "Program Made By ForAbby"->Str 1 For 1->Z To StrLen(Str 1) Text 28,14,StrLeft(Str 1,Z) Next For 1->Z To 500 Next '12_->_L 31->L '6_->_H 15->H 0-> (L*4)+1->L (H*4)+1->H While 1 If =0 Then Cls {30,92,92,30,30,1000,31,93,93}->List 1 64-{2,2,10,10,2,1000,11,11,3}->List 2 DrawStat Text 4,32,"MAZE GENERATOR" Text 18,45,"generate" Text 28,45,"length :" Text 28,78,(L-1)/4 Text 38,45,"heigt :" Text 38,71,(H-1)/4 Text 48,45,"quit" 18->A 28->B While 1 If A<>B Then Text B,40," " Text A,40,">" IfEnd Do Getkey2->Theta LpWhile Theta<>37 And Theta<>38 And Theta<>27 And Theta<>28 And Theta<>31 A->B Theta=37=>A<48=>A+10->A Theta=28=>A>18=>A-10->A If A=28 Then If Theta=27 And L<125 Then L+4->L Text 28,78,(L-1)/4 IfEnd If Theta=38 And L>9 Then L-4->L L=37=>Text 28,82," " Text 28,78,(L-1)/4 IfEnd IfEnd If A=38 Then If Theta=27 And H<60 Then H+4->H Text 38,71,(H-1)/4 IfEnd If Theta=38 And H>9 Then H-4->H H=37=>Text 38,75," " Text 38,71,(H-1)/4 IfEnd IfEnd If Theta=31 Then If A=18 Then 1-> Break IfEnd If A=48 Then ClrText Locate 6,4,"PRESS [EXIT]" Stop IfEnd IfEnd WhileEnd IfEnd If =1 Then Cls ClrList ClrMat For 1->Z To H Step 4 SketchNormal F-Line 1,64-Z,L,64-Z Next For 1->Z To L Step 4 SketchNormal F-Line Z,64-1,Z,64-H Next 4->A 4->B 1->D 0->E {Int (H/4),Int (L/4)}->Dim Mat A 5->Mat A[1,1] 5->Mat A[(H-1)/4,(L-1)/4] While 1 {0}->List 1 1->C If A/4<=L/4-1:' deal with #int Then If Mat A[B/4,(A/4)+1]=0 Then 1->List 1[C] Isz C IfEnd IfEnd If A/4>1 Then If Mat A[B/4,(A/4)-1]=0 Then 3->List 1[C] Isz C IfEnd IfEnd If B/4<=(H/4)-1:' deal with #int Then If Mat A[(B/4)+1,A/4]=0 Then 2->List 1[C] Isz C IfEnd IfEnd If B/4>1 Then If Mat A[(B/4)-1,A/4]=0 Then 4->List 1[C] Isz C IfEnd IfEnd If List 1[1]=0 Then If Mat A[B/4,A/4]=1 Then A-4->A Else If Mat A[B/4,A/4]=3 Then A+4->A Else If Mat A[B/4,A/4]=2 Then B-4->B Else If Mat A[B/4,A/4]=4 Then B+4->B IfEnd IfEnd IfEnd IfEnd Else If Dim List 1=1 Then 1->Theta Else RanInt#(1,Dim List 1)->Theta IfEnd If List 1[Theta]=1 Then PxlOff B,A+1 PxlOff B-1,A+1 PxlOff B-2,A+1 A+4->A Else If List 1[Theta]=2 Then PxlOff B+1,A PxlOff B+1,A-1 PxlOff B+1,A-2 B+4->B Else If List 1[Theta]=3 Then PxlOff B,A-3 PxlOff B-1,A-3 PxlOff B-2,A-3 A-4->A Else If List 1[Theta]=4 Then PxlOff B-3,A PxlOff B-3,A-1 PxlOff B-3,A-2 B-4->B IfEnd IfEnd IfEnd IfEnd List 1[Theta]->Mat A[B/4,A/4] Isz E IfEnd If E=(Int (L/4)*Int (H/4))-2 Then SketchDot Circle L-2,66-H,1 If RanInt#(0,1) Then PxlOff H-4,L-1 PxlOff H-4,L-2 PxlOff H-4,L-3 Else PxlOff H-1,L-4 PxlOff H-2,L-4 PxlOff H-3,L-4 IfEnd StoPict 1 3->A 61->B {A+1,A+1,A-1,A-1,A+1}->List 1 {B+1,B-1,B-1,B+1,B+1}->List 2 DrawStat 2-> Break IfEnd If Getkey=47 Then StoPict 1 Cls Text 22,54,"QUIT ?" Text 32,21,"[EXE]=yes" Text 32,74,"[EXIT]=no" Do Getkey2->Theta LpWhile Theta<>47 And Theta<>31 If Theta=47 Then Cls RclPict 1 Else 0-> Break IfEnd IfEnd WhileEnd IfEnd If =2 Then While 1 Do Getkey2->Theta LpWhile Theta<>27 And Theta<>28 And Theta<>37 And Theta<>38 And Theta<>47 A->C B->D If Theta=27 And PxlTest(64-B,A+2)=0 Then A+4->A IfEnd If Theta=38 And PxlTest(64-B,A-2)=0 Then A-4->A IfEnd If Theta=37 And PxlTest(66-B,A)=0 Then B-4->B IfEnd If Theta=28 And PxlTest(62-B,A)=0 Then B+4->B IfEnd If A<>C Or B<>D Then Cls {A+1,A+1,A-1,A-1,A+1}->List 1 {B+1,B-1,B-1,B+1,B+1}->List 2 RclPict 1 DrawStat IfEnd If Theta=47 Then Cls Text 22,54,"QUIT ?" Text 32,21,"[EXE]=yes" Text 32,74,"[EXIT]=no" Do Getkey2->Theta LpWhile Theta<>47 And Theta<>31 If Theta=47 Then Cls RclPict 1 DrawStat Else 0-> Break IfEnd IfEnd If A=L-2 And 66-B=H Then Cls Text 18,25,"YOU FINISH THE MAZE" Text 24,32,"CONGRATULATIONS" Text 33,14,"[EXIT]=quit" Text 33,65,"[EXE]=restart" Do Getkey2->Theta LpWhile Theta<>47 And Theta<>31 If Theta=47 Then 0-> Else 1-> IfEnd Break IfEnd WhileEnd IfEnd WhileEnd