コード例 #1
0
ファイル: Test2.py プロジェクト: arv100kri/Chowka-Bhara
     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()
         Tuple = gameBoard.movePawn(pawnChosen, gameBoard.getDiceValue())
         if Tuple[0]!=-1:
             print "Pawn ", Tuple[0], " is now at the position: ", Tuple[1].getPosition()
         print "======================================================================\n"
         print "State of the board \n"
         print "======================================================================\n"
         playerA.printValue()
         print "=======================================================================\n"
         playerB.printValue()
         print "=======================================================================\n"
         count+=1
         if gameBoard.hasTerminated() == True:
             winner = gameBoard.getWinner()
             break
     
     print "Game Over. The winner is ", winner
     print "Total number of moves ", count
     f.write(winner)
     f.write("\t")
     f.write(str(count))
     f.write("\n")
 f.close()