Example #1
0
    p2.updatePlayersHistory(ps[1],[m2,m1]) # WE PASS THE RESULT, PLAYER ONE WILL KNOW RESULT
    
def printPartials(pmoves,(p1,p2)):
    if pmoves==[1,-1]: 
        print "%s won (accumulating %d points) " %(p1.playerID, p1.myScore)
        print "%s lost (accumulating %d points) " %(p2.playerID, p2.myScore)
    elif pmoves==[0,0]:
        print "%s drew (accumulating %d points)" %(p1.playerID, p1.myScore)
        print "%s drew (accumulating %d points)" %(p2.playerID, p2.myScore)
    else:
        print "%s lost (accumulating %d points) " %(p1.playerID, p1.myScore)
        print "%s won (accumulating %d points) " %(p2.playerID, p2.myScore)

#+++++++++++++++++++++++
oponents= random.randint(0,4)
if oponents==0:
    players = (p.RandomPlayer('Tom'), p.RandomPlayer('Mary'))
elif oponents==1:
    players = (p.HumanPlayer('YOU'),p.RandomPlayer('Mary'))
elif oponents==2:
    players = (p.HumanPlayer('YOU'),p.StupidPlayer('Mary'))
elif oponents==3:
    players = (p.tftPlayer('Jim'),p.RandomPlayer('Lidia'))      
else :
    players = (p.RandomPlayer('Jim'),p.StupidPlayer('Lidia'))      

#+++++++++++++++++++++++    


rps(players,3)
#**************
Example #2
0
def printPartials(pmoves,(p1,p2)):
    if pmoves==[1,-1]: 
        print "%s won (accumulating %d points) " %(p1.playerID, p1.myScore)
        print "%s lost (accumulating %d points) " %(p2.playerID, p2.myScore)
    elif pmoves==[0,0]:
        print "%s drew (accumulating %d points)" %(p1.playerID, p1.myScore)
        print "%s drew (accumulating %d points)" %(p2.playerID, p2.myScore)
    else:
        print "%s lost (accumulating %d points) " %(p1.playerID, p1.myScore)
        print "%s won (accumulating %d points) " %(p2.playerID, p2.myScore)

#+++++++++++++++++++++++
oponents= 5#random.randint(0,5)
if oponents==0:
    players = (p.RandomPlayer('Tom'), p.RandomPlayer('Mary'))
elif oponents==1:
    players = (p.SequencePlayer('YOU'),p.RandomPlayer('Mary'))
elif oponents==2:
    players = (p.tftPlayer('YOU'),p.RandomPlayer('Mary'))
elif oponents==3:
    players = (p.tftPlayer('Jim'),p.SequencePlayer('Lidia'))
elif oponents == 4:
    players = (p.GAPlayer('Pepe'),p.tftPlayer('Mary'))      
elif oponents == 5:
    players = (p.RandomPlayer('Pepe'),p.GAPlayer('Mary'))
else :
    players = (p.RandomPlayer('Jim'),p.SequencePlayer('Lidia'))      

#+++++++++++++++++++++++    
rps(players,pointsToWin=20)
#**************