1 ; http://www.retroprogramming.com/2016/05/langtons-ant-for-zx-spectrum.html
2 ; Langton's Ant is an automata which creates a complex pattern by following
3 ; a couple of simple rules:
5 ; If the ant is on an empty pixel, turn 90 right, set the pixel then move forward
6 ; If the ant is on a set pixel, turn 90 left, reset the pixel then move forward
8 ; The ant's path appears chaotic at first before falling into a repetitive "highway"
9 ; pattern, moving 2 pixels diagonally every 104 cycles.
24 ; make it visually better ;-)
27 ld a,c ; check direction
34 add a,e ; adjust y position +/-1
41 add a,d ; adjust x position +/-1
45 and 7 ; calculate screen address
76 jr nz,LEFT ; turn left/right