diff --git a/network.py b/network.py index 0682fda..9eff2a8 100644 --- a/network.py +++ b/network.py @@ -142,19 +142,6 @@ class Network: return best_move_pair - def gen_21_rolls(self): - """ - Calculate all possible rolls, [[1,1], [1,2] ..] - :return: All possible rolls - """ - a = [] - for x in range(1,7): - for y in range(1,7): - if not [x,y] in a and not [y,x] in a: - a.append([x,y]) - - return a - def calculate_2_ply(self, sess, board, roll, player): """ Find the best move based on a 2-ply look-ahead. First the best move is found for a single ply and then an @@ -168,6 +155,18 @@ class Network: """ + def gen_21_rolls(): + """ + Calculate all possible rolls, [[1,1], [1,2] ..] + :return: All possible rolls + """ + a = [] + for x in range(1, 7): + for y in range(1, 7): + if not [x, y] in a and not [y, x] in a: + a.append([x, y]) + + return a init_legal_states = Board.calculate_legal_states(board, player, roll) zero_ply_moves_and_scores = [(move, self.eval_state(sess, self.board_trans_func(move, player))) for move in init_legal_states] @@ -177,7 +176,7 @@ class Network: best_fifteen.reverse() best_fifteen_boards = [x[0] for x in best_fifteen[:15]] - all_rolls = self.gen_21_rolls() + all_rolls = gen_21_rolls() all_rolls_scores = [] for a_board in best_fifteen_boards: