Rock, Paper, Scissors game (code included) (Sample Programs)

by tfitz19, Monday, January 24, 2011, 18:37 (3038 days ago) @ tfitz19

Just found a flaw that occasionally caused a win and lose message to come up:/
rewrote the end part and as far as i can tell, no flaws,
Here it is; if you find anything else let me know!

# Rock, Paper, Scissors
#created by tfitz19
#using BASIC-256

#choose your technique
input "Rock, Paper or Scissors? " , playerchoice$

#a random number is chosen and displayed
compchoice = rand
print compchoice
pause 2

#the number decides what the computer picks
if compchoice > 0 and compchoice < .33 then compchoice$ = "Rock"

if compchoice > .33 and compchoice < .66 then compchoice$ = "Scissors"

if compchoice > .66 and compchoice < 1 then compchoice$ = "Paper"

#the computers choice is shown
print "Computer chooses " + compchoice$
pause 2

#the winner is decided and displayed
if compchoice$ = playerchoice$ then
print "Draw"
end
end if

if playerchoice$ = "Rock" and compchoice$ = "Scissors" then
print "You Win"
end
end if

if playerchoice$ = "Rock" and compchoice$ = "Paper" then
print "You Lose"
end
end if

if playerchoice$ = "Rock" and compchoice$ = "Rock" then
print "You Drew"
end
end if

if playerchoice$ = "Paper" and compchoice$ = "Rock" then
print "You Win"
end
end if

if playerchoice$ = "Paper" and compchoice$ = "Scissors" then
print "You Lose"
end
end if

if playerchoice$ = "Paper" and compchoice$ = "Paper" then
print "You Drew"
end
end if

if playerchoice$ = "Scissors" and compchoice$ = "Paper" then
print "You Win"
end
end if

if playerchoice$ = "Scissors" and compchoice$ = "Rock" then
print "You Lose"
end
end if

if playerchoice$ = "Scissors" and compchoice$ = "Scissors" then
print "You Drew"
end
end if


Complete thread:

 RSS Feed of thread

powered by my little forum