Rock-paper-scissors: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 4,137: | Line 4,137: | ||
# Email : <calmosoft@gmail.com> |
# Email : <calmosoft@gmail.com> |
||
see " |
|||
welcome to the game of rock-paper-scissors. |
|||
each player guesses one of these three, and reveals it at the same time. |
|||
rock blunts scissors, which cut paper, which wraps stone. |
|||
if both players choose the same, it is a draw! |
|||
when you've had enough, choose q. |
|||
g = list(3) |
|||
" |
|||
g = ["rock","paper","scissors"] |
g = ["rock","paper","scissors"] |
||
total=0 |
total=0 draw=0 |
||
⚫ | |||
draw=0 |
|||
⚫ | |||
cwin=0 |
|||
see "what is your move (press r, p, or s)?" |
see "what is your move (press r, p, or s)?" |
||
while true |
while true |
||
Line 4,159: | Line 4,158: | ||
total = total + 1 |
total = total + 1 |
||
see"you chose " + g[gs] + " and i chose " + g[c] + nl |
see"you chose " + g[gs] + " and i chose " + g[c] + nl |
||
temp = gs-c |
|||
if temp = 0 |
|||
see ". it's a draw" |
see ". it's a draw" |
||
draw = draw + 1 |
draw = draw + 1 |
||
ok |
ok |
||
if |
if temp = 1 or temp = -2 |
||
see ". you win!" |
see ". you win!" |
||
pwin = pwin + 1 |
pwin = pwin + 1 |
||
ok |
ok |
||
if |
if temp = (-1) or temp = 2 |
||
see ". i win!" |
see ". i win!" |
||
cwin = cwin + 1 |
cwin = cwin + 1 |
||
ok |
ok |
||
end |
end |
||
func summarise() |
|||
see "you won " + pwin + ", and i won " + cwin + ". there were " + draw + " draws" + nl |
|||
see "thanks for playing!" + nl |
|||
</lang> |
</lang> |
||
Output: |
Output: |