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

by tfitz19, Monday, January 24, 2011, 17:55 (2853 days ago)

Hey, just been using this for one day and managed to make a pretty okay Rock, Paper, Scissors with no previous programming experience at all. Wanna say thanks to the programmers for such a helpful learning tool!:-D
Here's the code; if it could be improved or I've missed an easy way to simplify it please 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 choosed " + 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"
else
print "You Lose"
end
end if

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

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


Complete thread:

 RSS Feed of thread

powered by my little forum