예제 #1
0
파일: Test.py 프로젝트: jb08/AI
# 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
예제 #2
0
        #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) + "%"
예제 #3
0
# -*- 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)
예제 #4
0
    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