Langton's ant: Difference between revisions
→{{header|Common Lisp}}: Break out display logic.
(→{{header|D}}: Add Common Lisp) |
(→{{header|Common Lisp}}: Break out display logic.) |
||
Line 720:
(3 (decf x)))
)
grid
(dotimes (y height) ▼
)
)
(defun show-grid (grid)
(destructuring-bind (width height) (array-dimensions grid)
(dotimes (x width)
(princ (if (aref grid x y) "#" ".")))
Line 728 ⟶ 734:
(setf *random-state* (make-random-state t))
(show-grid (langtons-ant 100 100 (+ 45 (random 10)) (+ 45 (random 10)) (random 4)))</lang>
=={{header|D}}==
{{incorrect|D|The chirality of the output is reversed, meaning the ant is turning left when the spec says it should turn right, and vice-versa.}}
|