コード例 #1
0
ファイル: Test2.py プロジェクト: arv100kri/Chowka-Bhara
from core.game.model.Player import Player
#from core.game.model.Board import Board
from core.game.model.Board1 import Board
from core.game.timing import * 

if __name__ == '__main__': 
    f = open("IntelligentVsNaive_H4.txt","w")
    for i in range(0,50):
            
        pathArrayA=[(0,2),(0,1),(0,0),(1,0),(2,0),(3,0),(4,0),(4,1),(4,2),(4,3),(4,4),(3,4),(2,4),(1,4),(0,4),(0,3),(1,3),(2,3),(3,3),(3,2),(3,1),(2,1),(1,1),(1,2),(2,2)]
        pathArrayB=[(4,2),(4,3),(4,4),(3,4),(2,4),(1,4),(0,4),(0,3),(0,2),(0,1),(0,0),(1,0),(2,0),(3,0),(4,0),(4,1),(3,1),(2,1),(1,1),(1,2),(1,3),(2,3),(3,3),(3,2),(2,2)]
        
        playerA = Player("IntelligentAgent", pathArrayA, 4, True)
        
        playerB = Player("NaiveAgent", pathArrayB, 4, False)
        gameBoard = Board([playerA, playerB], 5)
        winner =""
        print "Initial State \n"
        playerA.printValue()
        playerB.printValue()
        print "*************************************************"
        count = 0
        while True:
            print "Chance of player: ", gameBoard.getCurrentPlayer().getPlayerName()
            gameBoard.setDiceValue()
            print "Dice Value is: ", gameBoard.getDiceValue()
            pawnChosen = gameBoard.choosePawnIntelligentVsNaive()
            if pawnChosen is None:
                print "Player ", gameBoard.getCurrentPlayer().getPlayerName(), "does not have any pawns to move this turn"
            else:
                print "Player ", gameBoard.getCurrentPlayer().getPlayerName()," has chosen the pawn ", pawnChosen.printDetail()
コード例 #2
0
ファイル: Test.py プロジェクト: arv100kri/Chowka-Bhara
@author: Ramitha Chitloor
'''

from core.game.model.Player import Player
#from core.game.model.Board import Board
from core.game.model.Board1 import Board
from core.game.timing import * 

if __name__ == '__main__': 
    pathArrayA=[(0,2),(0,1),(0,0),(1,0),(2,0),(3,0),(4,0),(4,1),(4,2),(4,3),(4,4),(3,4),(2,4),(1,4),(0,4),(0,3),(1,3),(2,3),(3,3),(3,2),(3,1),(2,1),(1,1),(1,2),(2,2)]
    pathArrayB=[(4,2),(4,3),(4,4),(3,4),(2,4),(1,4),(0,4),(0,3),(0,2),(0,1),(0,0),(1,0),(2,0),(3,0),(4,0),(4,1),(3,1),(2,1),(1,1),(1,2),(1,3),(2,3),(3,3),(3,2),(2,2)]
    
    playerA = Player("IntelligentAgent1", pathArrayA, 4, True)
    
    playerB = Player("RandomAgent1", pathArrayB, 4, False)
    gameBoard = Board([playerA, playerB], 5)
    print "Initial State \n"
    playerA.printValue()
    playerB.printValue()
    print "*************************************************"
    while gameBoard.isTerminated()!=True:
        print "Chance of player: ", gameBoard.getCurrentPlayer().getPlayerName()
        gameBoard.setDiceValue()
        print "Dice Value is: ", gameBoard.getDiceValue()
        pawnChosen = gameBoard.choosePawn()
        print "Player ", gameBoard.getCurrentPlayer().getPlayerName()," has chosen the pawn ", pawnChosen.printDetail()
        Tuple = gameBoard.movePawn(pawnChosen, gameBoard.getDiceValue())
        print "Pawn ", Tuple[0], " is now at the position: ", Tuple[1]
        print "======================================================================\n"
        print "State of the board \n"
        print "======================================================================\n"