Langton's ant: Difference between revisions

m
Line 521:
}
 
⍝ iterate one step: takes and returnreturns state as created by langton function
step ← {
grid ant dir ← ⍵
Line 534:
⍝ up is -1 0, right is 0 1, down is 1 0, and left is 0 -1
ant +← (4 2 ⍴ ¯1 0, 0 1, 1 0, 0 ¯1)[dir;]
 
grid ant dir
}
1,480

edits