Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Langtons-ant/J/langtons-ant.j
Normal file
11
Task/Langtons-ant/J/langtons-ant.j
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
dirs=: 0 1,1 0,0 _1,:_1 0
|
||||
langton=:3 :0
|
||||
loc=. <.-:$cells=. (_2{.y,y)$dir=. 0
|
||||
while. *./(0<:loc), loc<$cells do.
|
||||
color=. (<loc) { cells
|
||||
cells=. (-.color) (<loc)} cells
|
||||
dir=. 4 | dir + _1 ^ color
|
||||
loc=. loc + dir { dirs
|
||||
end.
|
||||
' #' {~ cells
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue