all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
36
Task/Wireworld/PicoLisp/wireworld.l
Normal file
36
Task/Wireworld/PicoLisp/wireworld.l
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
(load "@lib/simul.l")
|
||||
|
||||
(let
|
||||
(Data (in "wire.data" (make (while (line) (link @))))
|
||||
Grid (grid (length (car Data)) (length Data)) )
|
||||
(mapc
|
||||
'((G D) (mapc put G '(val .) D))
|
||||
Grid
|
||||
(apply mapcar (flip Data) list) )
|
||||
(loop
|
||||
(disp Grid T
|
||||
'((This) (pack " " (: val) " ")) )
|
||||
(wait 1000)
|
||||
(for Col Grid
|
||||
(for This Col
|
||||
(case (=: next (: val))
|
||||
("H" (=: next "t"))
|
||||
("t" (=: next "."))
|
||||
("."
|
||||
(when
|
||||
(>=
|
||||
2
|
||||
(cnt # Count neighbors
|
||||
'((Dir) (= "H" (get (Dir This) 'val)))
|
||||
(quote
|
||||
west east south north
|
||||
((X) (south (west X)))
|
||||
((X) (north (west X)))
|
||||
((X) (south (east X)))
|
||||
((X) (north (east X))) ) )
|
||||
1 )
|
||||
(=: next "H") ) ) ) ) )
|
||||
(for Col Grid # Update
|
||||
(for This Col
|
||||
(=: val (: next)) ) )
|
||||
(prinl) ) )
|
||||
Loading…
Add table
Add a link
Reference in a new issue