Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MazeBall & DAV & Danilin Solve of Labyrinth
#2
In Honor of America's Discovery Day

Automation of MazeRND maze

In reality ball flies aimlessly
and star intersects randomly

author of program encrypted maze into a string
Code: (Select All)
'x is wall & b is ball & y is star
If puzzle=11 Then
    puz$="": grid=8
    puz$=puz$+"xxxxxxxx"
    puz$=puz$+"x   xb x"
    puz$=puz$+"x   yx x"
    puz$=puz$+"x  xx  x"
    puz$=puz$+"x      x"
    puz$=puz$+"x      x"
    puz$=puz$+"x      x"
    puz$=puz$+"xxxxxxxx"
End If
We start variables and build walls of an empty maze
where delta is direction of movement 0 > / 1 < / 2 V / 3 ^
Code: (Select All)
Dim d(22, 22), m(22, 22): m$="": all=0: Randomize Timer
delta=Int(Rnd*4): puz$="": grid=Int(Rnd*7)+8: f=grid

For a=1 To f: m(1, a)=1: m(f, a)=1: Next
For a=2 To f-1: m(a, 1)=1: m(a, f)=1:
    For b=2 To f-1: m(a,b)=0
Next: Next
We fill 20% of walls and put a star and a ball
and add up string puz$
Code: (Select All)
For i=1 To .2*f^2 : m(Rnd*f, Rnd*f)=1: Next

m(Rnd*(f-3)+2, Rnd*(f-3)+2)=2 ' y
m(Rnd*(f-3)+2, Rnd*(f-3)+2)=3 ' b

For a=1 To f: For b=1 To f ': Print m(a,b);
    If m(a,b)=1 Then m$=m$+"x"
        If m(a,b)=0 Then m$=m$+" "
        If m(a,b)=2 Then m$=m$+"y"
        If m(a,b)=3 Then m$=m$+"b"
Next: Next: puz$=m$
To be continued...


.bas   MAZEsite.bas (Size: 60.3 KB / Downloads: 6)


Attached Files
.bas   MAZErnd.bas (Size: 64.12 KB / Downloads: 27)
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply


Messages In This Thread
RE: MazeBall & DAV & Danilin Solve of Labyrinth - by DANILIN - 10-12-2024, 11:57 AM



Users browsing this thread: 1 Guest(s)