fix bot.py

This commit is contained in:
Alexander Munch-Hansen 2018-03-06 13:08:01 +01:00
parent d2b1f5d523
commit b6fdffd958

4
bot.py
View File

@ -40,8 +40,8 @@ class Bot:
legal_moves = Board.calculate_legal_states(board, sym, roll) legal_moves = Board.calculate_legal_states(board, sym, roll)
moves_and_scores = [ (move, self.network.eval_state(np.array(move).reshape(1,26))) for move in legal_moves ] moves_and_scores = [ (move, self.network.eval_state(np.array(move).reshape(1,26))) for move in legal_moves ]
scores = [ x[1] for x in moves_and_scores ] scores = [ x[1] for x in moves_and_scores ]
best_move = moves_and_scores[np.array(scores).argmax()][0] best_move_pair = moves_and_scores[np.array(scores).argmax()]
#print("Found the best state, being:", np.array(move_scores).argmax()) #print("Found the best state, being:", np.array(move_scores).argmax())
return best_move return best_move_pair
# return random.choice(list(legal_moves)) # return random.choice(list(legal_moves))