Langton's ant: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed/added comments and whitespace, changed indentations, used dynamic field, so the ant is less constricted for its walk.) |
m (→{{header|REXX}}: added glyphs to the output to show the ant's walk started and where it went out-of-bounds.) |
||
Line 4,677: | Line 4,677: | ||
/*finished walking, it's out-of-bounds.*/ |
/*finished walking, it's out-of-bounds.*/ |
||
say center(" Langton's ant walked " steps ' steps. ', 79, "─") |
say center(" Langton's ant walked " steps ' steps. ', 79, "─") |
||
@.1000000.1000000='█' /*show the ant's initial starting point*/ |
|||
@.x.y= '∙' /*show where the ant went out-of-bounds*/ |
|||
/* [↓] show Langton's ant's trail. */ |
/* [↓] show Langton's ant's trail. */ |
||
do y=maxy to miny by -1; _= /*display a single row of cells. */ |
do y=maxy to miny by -1; _= /*display a single row of cells. */ |
||
Line 4,685: | Line 4,687: | ||
end /*y*/ /*stick a fork in it, we're all done. */</lang> |
end /*y*/ /*stick a fork in it, we're all done. */</lang> |
||
The terminal's screen size used was <big>80</big>x<big>160</big>. |
The terminal's screen size used was <big>80</big>x<big>160</big>. |
||
The ant's walk starts at the █ glyph and ends at <big><b>'''∙'''</b></big> where it goes out-of-bounds. |
|||
'''output''' when using the default inputs: |
'''output''' when using the default inputs: |
||
Line 4,690: | Line 4,694: | ||
<b> |
<b> |
||
<pre style="font-size:67%"> |
<pre style="font-size:67%"> |
||
∙ |
|||
───────────────────── Langton's ant walked 12960 steps. ───────────────────── |
|||
# # |
# # |
||
## # # |
## # # |
||
Line 4,744: | Line 4,748: | ||
# ## # ## # # ##### # ##### # # # ### # |
# ## # ## # # ##### # ##### # # # ### # |
||
# ## ### ### # # ## # ## ###### # # ## # ### |
# ## ### ### # # ## # ## ###### # # ## # ### |
||
# #### ## # # ### ### # |
# #### ## # # ### ### #█ ## ## # ## # # ### # |
||
## # ## # ######### ## #### # ## # ### |
## # ## # ######### ## #### # ## # ### |
||
# # # #### # ########### ## # # # ### # |
# # # #### # ########### ## # # # ### # |