diff --git a/app.py b/app.py index 8d63c81..c774cb7 100644 --- a/app.py +++ b/app.py @@ -29,7 +29,7 @@ def calc_move_sets(from_board, roll, player): sets = [] total = 0 for r in roll: - print("Value of r:", r) + # print("Value of r:", r) sets.append([Board.calculate_legal_states(board, player, [r, 0]), r]) total += r sets.append([Board.calculate_legal_states(board, player, [total, 0]), total]) @@ -45,9 +45,9 @@ def tmp_name(from_board, to_board, roll, player, total_moves, is_quad=False): # print(to_board) # print(board_set) if to_board in board_set[0]: - print("To board:", to_board) - print(board_set[0]) - print(board_set[1]) + # print("To board:", to_board) + # print(board_set[0]) + # print(board_set[1]) total_moves -= board_set[1] # if it's not the sum of the moves if idx < (4 if is_quad else 2): @@ -57,18 +57,12 @@ def tmp_name(from_board, to_board, roll, player, total_moves, is_quad=False): return_board = to_board break - print("Return board!:\n",return_board) + # print("Return board!:\n",return_board) return total_moves, roll, return_board -def calc_move_stuff(from_board, to_board, roll, player): +def calc_move_stuff(from_board, to_board, roll, player, total_roll, is_quad): - is_quad = roll[0] == roll[1] - - total_moves = roll[0] + roll[1] if not is_quad else int(roll[0]) * 4 - if is_quad: - roll = [roll[0]] * 4 - - total_moves, roll, board = tmp_name(from_board, to_board, list(roll), player, total_moves, is_quad) + total_moves, roll, board = tmp_name(from_board, to_board, list(roll), player, total_roll, is_quad) return board, total_moves, roll @@ -97,9 +91,9 @@ def bot_move(): board = [int(x) for x in data['board'].split(',')] roll = (random.randrange(1,7), random.randrange(1,7)) - print(roll) + # print(roll) board, _ = network.make_move(tuple(board), roll, 1) - print("Boards!:",board) + # print("Boards!:",board) return ",".join([str(x) for x in list(board)]) @@ -115,13 +109,14 @@ def post_board(): board = [int(x) for x in data['board'].split(',')] prev_board = [int(x) for x in data['prev_board'].split(',')] roll = [int(x) for x in data['roll'].split(',')] + quad = data['quad'] == "true" - print(board) + # print(board) total_roll = int(data['total_roll']) - - return_board, total_moves, roll = calc_move_stuff(tuple(prev_board), tuple(board), tuple(roll), player) + print("total roll is:", total_roll) + return_board, total_moves, roll = calc_move_stuff(tuple(prev_board), tuple(board), tuple(roll), player, total_roll, quad)