Rock-paper-scissors: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: eliminated the need for a statement.)
(→‎{{header|REXX}}: used a co-array for testing for wins instead of discrete statements.)
Line 3,423:
prompt= ! 'Please enter one of: Rock Paper Scissors (or Quit)'
$.p='paper'; $.s='scissors'; $.r='rock' /*computer's choices.*/
t.p=$.r ; t.s=$.p ; t.r=$.s /*thingys beats stuff*/
b.p=' covers '; b.s=' cuts '; b.r=' breaks ' /*how the choice wins*/
 
Line 3,449 ⟶ 3,450:
say ! 'computer chose: ' c
if a1==c1 then do; say ! 'draw.'; iterate; end
if $.a1==t.c1 then say ! 'Rthe computer wins. ' & ! $.c1=='S' |,b.c1 $.a1
a1=='P' & c1=='R' then say ! | 'you win! ' ! $.a1 b.a1 $.c1
a1=='S' & c1=='P' |,
a1=='P' & c1=='R' then say ! 'you win! ' ! $.a1 b.a1 $.c1
else say ! 'the computer wins. ' ! $.c1 b.c1 $.a1
end /*forever*/
/*stick a fork in it, we're done.*/</lang>