Rock-paper-scissors: Difference between revisions
Content added Content deleted
Childishbeat (talk | contribs) m (Wee Basic is being moved to the correct place.) |
Childishbeat (talk | contribs) m (Now Wee Basic has been moved to the correct place.) |
||
Line 5,514: | Line 5,514: | ||
echo "I picked ${choices[i]} $(( computer_counts[i] )) times." |
echo "I picked ${choices[i]} $(( computer_counts[i] )) times." |
||
done</lang> |
done</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> |
|||
=={{header|Yabasic}}== |
=={{header|Yabasic}}== |