74 lines
1.3 KiB
Plaintext
74 lines
1.3 KiB
Plaintext
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
|
|
elseif human=$="R"
|
|
let human$="rock"
|
|
let entered=1
|
|
elseif human=$="p"
|
|
let human$="paper"
|
|
let entered=1
|
|
elseif human=$="P"
|
|
let human$="paper"
|
|
let entered=1
|
|
elseif human=$="s"
|
|
let human$="scissors"
|
|
let entered=1
|
|
elseif human=$="S"
|
|
let human$="scissors"
|
|
let entered=1
|
|
elseif 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"
|
|
elseif rcounter=2
|
|
let cpu$="paper"
|
|
elseif 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
|