Rock-paper-scissors: Difference between revisions

Content added Content deleted
mNo edit summary
m (→‎{{header|REXX}}: added/changed comments in the REXX section header, added a programming note in the output section.)
Line 3,415: Line 3,415:
This version of the REXX program:
This version of the REXX program:
::* allows the human player to abbreviate their choice
::* allows the human player to abbreviate their choice
::* issues appropriate error messages for an incorrect (or no) choice(s)
::* allows the human player to   QUIT   at any time
::* allows the human player to   QUIT   at any time
::* keeps track of the human player's responses   (to make a hopefully winning choice)
::* keeps track of the human player's responses   (to hopefully make computer winning choices)
::* uses proper "English"   ''rock breaks scissors''
::* uses proper "English"   ''rock breaks scissors''
<lang rexx>/*REXX pgm plays rock-paper-scissors with a CBLF (carbon-based life form*/
<lang rexx>/*REXX pgm plays rock-paper-scissors with a CBLF (carbon-based life form*/
Line 3,454: Line 3,455:
end /*forever*/
end /*forever*/
/*stick a fork in it, we're done.*/</lang>
/*stick a fork in it, we're done.*/</lang>
Programming note: &nbsp; REXX program statement (line) 15:
<lang> upper a; a1=left(a,1) /*uppercase answer, get 1st char.*/</lang>
could be replaced with a more compact (and faster and obtuse and less idiomatic) version:
<lang>parse upper var a a 1 a1 2</lang><br>

'''output''' with various responses from the user &nbsp; (output shown is a screen scraping):
'''output''' with various responses from the user &nbsp; (output shown is a screen scraping):
<pre>
<pre>