Jump to content

Rock-paper-scissors: Difference between revisions

m
A GlovePIE section has been added.
m (A GlovePIE section has been added.)
Line 1,802:
$
</lang>
 
=={{header|GlovePIE}}==
You can only press the R, P or S key to advance.
<lang glovepie>if var.end=0 then
var.end=0
var.computerchoice=random(3) // 1 is rock, 2 is paper, and 3 is scissors.
debug="Press the R key for rock, the P key for paper, or the S key for scissors:"
endif
if pressed(Key.R)and var.end=0 then
var.end=1
if var.computerchoice=1 then
debug="You chose rock, which the computer also chose, so it's a tie!"
else
if var.computerchoice=2 then
debug="The computer chose paper, covering your choice of rock, so you lose!"
else
debug="You chose rock, smashing the computer's choice of scissors, so you win!"
endif
endif
endif
if pressed(Key.P)and var.end=0 then
var.end=1
if var.computerchoice=1 then
debug="You chose paper, covering the computer's choice of rock, so you win!"
else
if var.computerchoice=2 then
debug="You chose paper, which the computer also chose, so it's a tie!"
else
debug="The computer chose scissors, cutting your choice of paper, so you lose!"
endif
endif
endif
if pressed(Key.S)and var.end=0 then
var.end=1
if var.computerchoice=1 then
debug="The computer chose rock, smashing your choice of scissors, so you lose!"
else
if var.computerchoice=2 then
debug="You chose scissors, cutting the computer's choice of paper, so you win!"
else
debug="You chose scissors, which the computer also chose, so it's a tie!"
endif
endif
endif</lang>
 
=={{header|Go}}==
441

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.