def testDealerStrategy(self): print("") runs = GameParser.parse('../Games/strategy-dealer.csv') game = Game(DealerStrategy(), { 'debug': True }) for run in runs: print("") print(run) shoe = Shoe(run['cards']) self.assertEquals(game.play(shoe), run['result'])
def testStandStrategy(self): print("") runs = GameParser.parse('../Games/strategy-stand.csv') game = Game(Strategy(), { 'debug': True }) for run in runs: print("") print(run) shoe = Shoe(run['cards']) self.assertEquals(game.play(shoe), run['result']) self.assertTrue(shoe.isEmpty())
def getMove(self, board): """ Return best action according to self.evaluationFunction, with no lookahead. """ v_best = 0 a_best = None all_moves = board.getAllMoves(self.color) for a in all_moves: board.doMove(a) features = GameParser.getFeaturesForState(board) v = self.model.get_output(features) v = 1. - v if self.color == Color.BLACK else v if v > v_best: v_best = v a_best = a board.undoMove(a) return a_best