Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Maze-generation/PicoLisp/maze-generation.l
Normal file
30
Task/Maze-generation/PicoLisp/maze-generation.l
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
(load "@lib/simul.l")
|
||||
|
||||
(de maze (DX DY)
|
||||
(let Maze (grid DX DY)
|
||||
(let Fld (get Maze (rand 1 DX) (rand 1 DY))
|
||||
(recur (Fld)
|
||||
(for Dir (shuffle '((west . east) (east . west) (south . north) (north . south)))
|
||||
(with ((car Dir) Fld)
|
||||
(unless (or (: west) (: east) (: south) (: north))
|
||||
(put Fld (car Dir) This)
|
||||
(put This (cdr Dir) Fld)
|
||||
(recurse This) ) ) ) ) )
|
||||
(for (X . Col) Maze
|
||||
(for (Y . This) Col
|
||||
(set This
|
||||
(cons
|
||||
(cons
|
||||
(: west)
|
||||
(or
|
||||
(: east)
|
||||
(and (= Y 1) (= X DX)) ) )
|
||||
(cons
|
||||
(: south)
|
||||
(or
|
||||
(: north)
|
||||
(and (= X 1) (= Y DY)) ) ) ) ) ) )
|
||||
Maze ) )
|
||||
|
||||
(de display (Maze)
|
||||
(disp Maze 0 '((This) " ")) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue