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 ]