"""hi i am having heaps of trouble with calling my whoWins function from main. i can get all of my other functions to call ok from main, but am having trouble with this one for some reason. any help would be greatly apreciated. cheers joel"""
import random
Ascore = 0
Bscore = 0
Dscore = 0
table = {1:"Rock", 2:"Paper",3:"Scissors"}
gameList = []
turnTuple = ()
Awins = {(2,1):"Paper beats rock - Player A wins",
(1,3):"Rock beats scissors - Player A wins",
(3,2):"Scissors beat paper - Player A wins."}
Bwins = {(1,2):"Paper beats rock - Player B wins",
(3,1):"Rock beats scissors - Player B wins",
(2,3):"Scissors beat paper - Player B wins."}
Cdraws = {(1,1):"Its a draw.",
(2,2):"Its a draw.",
(3,3):"Its a draw."}
def intro():
print "\t\t\t\tRock, Paper, Scissors" # Prints program intro
print "\t\t\t\t\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ "
print "\t\t\t\t\tby"
print "\t\t\t\t Joel Watts"
print "\t\t\t\t \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ "
print
print " \t\t\t\tInstructions\t\t\t\t\t\n The aim of this game is to play rock paper scissors. The computer is to \
simulate the whole game by producing the results for each game along with a statement declaring who has won the match."
# Here is the code so far
# for players A and B:
while Ascore < 10 and Bscore < 10:
x = 0
y = 0
print "hello"
x = random.randrange(1,4)
y = random.randrange(1,4)
turnA = table[x]
turnB = table[y]
turnTuple = (x,y)
print "player A chose:",turnA
print "player B chose:",turnB
print
def whoWins():
if turnTuple in Awins:
print Awins[turnTuple]
Ascore = Ascore + 1
elif turnTuple in Bwins:
print Bwins[turnTuple]
Bscore = Bscore + 1
elif turnTuple in Cdraws:
Dscore = Dscore + 1
print Cdraws[turnTuple]
#TESTING 1 2 3
def priSummary():
print
print "A scored: ", Ascore
print "B scored: ", Bscore
print "Draws: ", Dscore
def main():
intro()
priSummary()
whoWins()
if __name__ == '__main__':
main()