Langton's ant: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added glyphs to the output to show the ant's walk started and where it went out-of-bounds. |
m →{{header|REXX}}: adjusted useable screen size. |
||
Line 4,656: | Line 4,656: | ||
if char=='' | char=="," then char= '#' /*binary colors: 0≡white, 1≡black. */ |
if char=='' | char=="," then char= '#' /*binary colors: 0≡white, 1≡black. */ |
||
parse value scrSize() with sd sw . /*obtain the terminal's depth and width*/ |
parse value scrSize() with sd sw . /*obtain the terminal's depth and width*/ |
||
sd=sd- |
sd=sd-6; sw=sw-1 /*adjust for terminal's useable area. */ |
||
x=1000000 ; y=1000000 /*start ant's walk in middle of nowhere*/ |
x=1000000 ; y=1000000 /*start ant's walk in middle of nowhere*/ |
||
$.=1; $.0=4 ; $.2=2; $.3=3; $.4=4 /* 1≡north 2≡east 3≡south 4≡west.*/ |
$.=1; $.0=4 ; $.2=2; $.3=3; $.4=4 /* 1≡north 2≡east 3≡south 4≡west.*/ |
||
Line 4,672: | Line 4,672: | ||
when dir==4 then x= x - 1 /* " " " west? " " left. */ |
when dir==4 then x= x - 1 /* " " " west? " " left. */ |
||
end /*select*/ |
end /*select*/ |
||
minx=min(minx,x); |
minx=min(minx, x); maxx=max(maxx, x) /*find the minimum and maximum of X. */ |
||
miny=min(miny, y); maxy=max(maxy, y) /* " " " " " " Y. */ |
|||
end /*steps*/ |
end /*steps*/ |
||
/*finished walking, it's out-of-bounds.*/ |
/*finished walking, it's out-of-bounds.*/ |