Anonymous user
Rock-paper-scissors: Difference between revisions
m
→extended, 5 choices: added whitespace.
m (→extended, 5 choices: added/changed whitespace and comments.) |
m (→extended, 5 choices: added whitespace.) |
||
Line 4,465:
!= '────────'; err=! "***error***"; @.=0 /*some constants for this REXX program.*/
prompt=! 'Please enter one of: Rock Paper SCissors Lizard SPock (Vulcan) (or Quit)'
$.p='paper' ; $.s="scissors" ; $.r=
t.p= $.r $.v ; t.s= $.p $.L ; t.r= $.s $.L ; t.L= $.p $.v ; t.v= $.r $.s /*thingys beats stuff.*/
w.p= $.L $.s ; w.s= $.v $.r ; w.r= $.v $.p ; w.L= $.r $.s ; w.v= $.L $.p /*stuff beats thingys.*/
Line 4,472:
do forever; say; say prompt; say /*prompt CBLF; then get a response. */
c= word($.p $.s $.r $.L $.v, random(1, 5) )
m= max(@.r, @.p, @.s, @.L, @.v)
if @.p==m then c= word(w.p, random(1, 2) ) /*emulate JC's The Amazing Karnac. */
if @.s==m then c= word(w.s, random(1, 2) ) /* " " " " " */
|