Rock-paper-scissors: Difference between revisions
Content added Content deleted
(GP) |
|||
Line 1,786: | Line 1,786: | ||
H: rock, C: paper => Computer wins |
H: rock, C: paper => Computer wins |
||
score: human=0, computer=10</pre> |
score: human=0, computer=10</pre> |
||
=={{header|Run BASIC}}== |
|||
<lang runbasic>pri$ = "RSPR" |
|||
rps$ = "Rock,Paper,Sissors" |
|||
[loop] |
|||
button #r, "Rock", [r] |
|||
button #p, "Paper", [p] |
|||
button #s, "Scissors",[s] |
|||
button #q, "Quit", [q] |
|||
wait |
|||
[r] y = 1 :goto [me] |
|||
[p] y = 2 :goto [me] |
|||
[s] y = 3 |
|||
[me] |
|||
cls |
|||
y$ = word$(rps$,y,",") |
|||
m = int((rnd(0) * 2) + 1) |
|||
m$ = word$(rps$,m,",") |
|||
print chr$(10);"You Chose:";y$;" I chose:";m$ |
|||
yp = instr(pri$,left$(y$,1)) |
|||
mp = instr(pri$,left$(m$,1)) |
|||
if yp = 1 and mp = 3 then mp = 0 |
|||
if mp = 1 and yp = 3 then yp = 0 |
|||
if yp < mp then print "You win" |
|||
if yp = mp then print "Tie" |
|||
if yp > mp then print "I win" |
|||
goto [loop] |
|||
wait |
|||
[q] cls |
|||
print "Good Bye! I enjoyed the game" |
|||
end |
|||
</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |