Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Langtons-ant/XPL0/langtons-ant.xpl0
Normal file
17
Task/Langtons-ant/XPL0/langtons-ant.xpl0
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
include c:\cxpl\codes; \intrinsic 'code' declarations
|
||||
int X, Y, Dir;
|
||||
[SetVid($13); \set 320x200 graphic video mode
|
||||
X:= 50; Y:= 50; Dir:= 0; \start in middle facing east
|
||||
repeat if ReadPix(X,Y) then \(black and white are reversed)
|
||||
[Dir:= Dir-1;\left\ Point(X,Y, 0\black\)]
|
||||
else [Dir:= Dir+1;\right\ Point(X,Y,$F\white\)];
|
||||
case Dir & 3 of
|
||||
0: X:= X+1; \east
|
||||
1: Y:= Y+1; \south
|
||||
2: X:= X-1; \west
|
||||
3: Y:= Y-1 \north
|
||||
other [];
|
||||
until X<0 ! X>=100 ! Y<0 ! Y>=100;
|
||||
X:= ChIn(1); \wait for keystroke
|
||||
SetVid(3); \restore normal text mode
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue