[Tutor] Help With Rock, Paper Scissor Game

Brendy Siguenza s.brendy at gmail.com
Mon Mar 16 02:29:01 CET 2009


This is the template that we are suppose to use while doing the program, I
am a beginner to this programming language and really have no clue what I am
doing


import random
#table of winning plays
win_play_for = {¹r¹:¹p¹, ¹p¹:¹s¹, ¹s¹:¹r¹}

#scoring results
player_score = 0
mach_score = 0

#keep track of users¹last plays
#assume initially an even distribution
hist = [¹r¹, ¹p¹, ¹s¹, ¹r¹, ¹p¹, ¹s¹, ¹r¹, ¹p¹, ¹s¹]
next = 0 #index of where to put next user play

while True:
#guess what user play will be based on past
#behavior. Pick a machine play to win based
#on guess

#get user¹s play
user_play = raw_input("what¹s your play (r|p|s)? ")
#if the user does not respond with one of those break

#otherwise
#update history of user plays

#determine winner for current play or draw
#print results of current play and scores so far


NOW THIS IS WHAT I HAVE SO FAR, AND THESE ARE ALL JUMBLE AROUND BECAUSE I
HAVE NO CLUE WHERE THEY ARE SUPPOSE TO GO PLZ HELP


import random

#table of winning plays
win_play_for = {'r':'p', 'p':'s', 's':'r'}


#scoring results
player_score = 0
mach_score = 0

#kepp track of users' last plays
#assume initially an even distribution
hist = ['r', 'p', 's', 'r', 'p', 's', 'r', 'p', 's']
next = 0 #index of where to put next user play


while True:
    hist = ['r', 'p', 's', 'r', 'p', 's', 'r', 'p', 's']
    next = 0
    guess = random_choice(hist)
    len (hist)

    
    #gets user's play
    user_play = raw_input("What's your play (r|p|s)?")
    hist[next] = user_play
    next = next + 1
    if next == len(hist):
        next = 0
        
    user_play == win_play_for(mach_play)
    mach_play == win_play_for(user_play)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090315/baf70d7d/attachment-0001.htm>


More information about the Tutor mailing list