Rock-paper-scissors: Difference between revisions
Content deleted Content added
Childishbeat (talk | contribs) m Wee Basic has been added. |
Childishbeat (talk | contribs) m Wee Basic is being moved to the correct place. |
||
Line 5,594: | Line 5,594: | ||
data "Spock","vaporizes","Rock" |
data "Spock","vaporizes","Rock" |
||
data "Rock","blunts","Scissors"</lang> |
data "Rock","blunts","Scissors"</lang> |
||
=={{header|Wee Basic}}== |
|||
<lang Wee Basic>let entered=0 |
|||
let keycode=0 |
|||
let rcounter=1 |
|||
print 1 "Enter R for rock, P for paper, or S for scissors. (not case sensitive)" |
|||
while entered=0 |
|||
input human$ |
|||
if human=$="r" |
|||
let human$="rock" |
|||
let entered=1 |
|||
endif |
|||
if human=$="R" |
|||
let human$="rock" |
|||
let entered=1 |
|||
endif |
|||
if human=$="p" |
|||
let human$="paper" |
|||
let entered=1 |
|||
endif |
|||
if human=$="P" |
|||
let human$="paper" |
|||
let entered=1 |
|||
endif |
|||
if human=$="s" |
|||
let human$="scissors" |
|||
let entered=1 |
|||
endif |
|||
if human=$="S" |
|||
let human$="scissors" |
|||
let entered=1 |
|||
endif |
|||
if entered=0 |
|||
print 1 "That choice is invalid." |
|||
endif |
|||
wend |
|||
print 1 "Press any key so the computer can make its choice." |
|||
while keycode=0 |
|||
let rcounter=rcounter+1 |
|||
let keycode=key() |
|||
if rcounter=4 |
|||
let rcounter=1 |
|||
endif |
|||
wend |
|||
if rcounter=1 |
|||
let cpu$="rock" |
|||
endif |
|||
if rcounter=2 |
|||
let cpu$="paper" |
|||
endif |
|||
if rcounter=3 |
|||
let cpu$="scissors" |
|||
endif |
|||
print 1 "You chose"+human$+"." |
|||
print 1 "The computer chose"+cpu$+"." |
|||
if human$=cpu$ |
|||
print 1 "You tied." |
|||
endif |
|||
if human$="rock" |
|||
if cpu$="paper" |
|||
print 1 "Paper covers rock, so you lose." |
|||
endif |
|||
if cpu$="scissors" |
|||
print 1 "Rock blunts scissors, so you win." |
|||
endif |
|||
endif |
|||
if human$="paper" |
|||
if cpu$="rock" |
|||
print 1 "Paper covers rock, so you win." |
|||
endif |
|||
if cpu$="scissors" |
|||
print 1 "Scissors cut paper, so you lose." |
|||
endif |
|||
endif |
|||
if human$="scissors" |
|||
if cpu$="rock" |
|||
print 1 "Rock blunts scissors, so you lose." |
|||
endif |
|||
if cpu$="paper" |
|||
print 1 "Scissors cut paper, so you win." |
|||
endif |
|||
endif |
|||
end</lang> |