Langton's ant: Difference between revisions

Line 2,670:
 
=={{header|Prolog}}==
This sort of problem, when stated in Prolog, reads a bit like a story book. Our main goal (go) succeeds if we can move north from the middle of the 100x100 matrix, and update_win- which outputs the black/1 blocks. The move/3 and direction/3 goals are really quite self explanatory, mirroring the instructions for the task.
[[File:ant.jpg|thumb|right|Sample output]]]
<lang prolog>%_______________________________________________________________
% Langtons ant.
Anonymous user