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 ! '
▲ a1=='P' & c1=='R' then say ! 'you win! ' ! $.a1 b.a1 $.c1
end /*forever*/
/*stick a fork in it, we're done.*/</lang>
|