# game.makeMove(p1, 4) # game.makeMove(p1, 6) # game.makeMove(p2, 0) # game.makeMove(p2, 2) # game.makeMove(p2, 5) #game.hostGame(p1,p2) ABPRUNE_won = 0 Other_won = 0 tie = 0 for i in range(3): #print i game.reset() game.hostGame(p1,p2) if game.hasWon(1): ABPRUNE_won +=1 elif game.hasWon(2): Other_won +=1 else: tie +=1 print "results:" print " CUSTOM won: ", ABPRUNE_won print " Other won: ", Other_won print " tie: ", tie
#reset the scores p1 = 0 p2 = 0 print "" print "***********************************************" print "me" + str(meNume + 1) + " playing against opponent" + str(oppNum + 1) elapsed = 0 for i in enumerate(range(1, iterations)): start_time = time.time() winner = myBoard.hostGame(me, currentOpponent) elapsed = float(elapsed) + float(time.time() - start_time) if winner == '1': p1 = p1 + 1 elif winner == '2': p2 = p2 + 1 else: continue percent_won = float(p1) / float(iterations) percent_lost = float(p2) / float(iterations) #percent_tied = float(iterations - (p1 + p2)) / float(iterations) * 10 print "You won: " + str(percent_won) + "%\nOpponent won: " + str( percent_lost) + "%"
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 21:08:18 2015 @author: Peter """ from MancalaBoard import * p1 = pbh423(1,Player.CUSTOM) p2 = Player(2, Player.HUMAN) mb = MancalaBoard() mb.hostGame(p1, p2)
for oppNum, currentOpponent in enumerate(opponents): #reset the scores p1 = 0 p2 = 0 if report: print "me" + str(meNume + 1) + " playing against opponent" + str(oppNum + 1) elapsed = 0 for i in enumerate(range(1,iterations)): start_time = time.time() winner = myBoard.hostGame(me, currentOpponent) elapsed = float(elapsed) + float(time.time() - start_time) if winner == '1': p1 = p1 + 1 elif winner == '2': p2 = p2 + 1 else: continue percent_won = float(p1) / float(iterations) percent_lost = float(p2) / float(iterations) #percent_tied = float(iterations - (p1 + p2)) / float(iterations) * 10