From 00974b0f11228b53166a6a945ec77c7da657aa87 Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Mon, 14 May 2018 13:07:48 +0200 Subject: [PATCH] Added '--play' flag, so you can now play against the ai. --- board.py | 22 ++++++++++------------ main.py | 5 ++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/board.py b/board.py index ede4b87..0233cf2 100644 --- a/board.py +++ b/board.py @@ -230,19 +230,17 @@ class Board: #print("boards after first die: ", boards) for die in roll[1:]: - # if die != 0: - if True: - # Calculate boards resulting from second move - nested_boards = [calc_moves(board, die) for board in boards] - #print("nested boards: ", nested_boards) - boards = [board for boards in nested_boards for board in boards] - # What the fuck - #for board in boards: - # print(board) - # print("type__:",type(board)) - # Add resulting unique boards to set of legal boards resulting from roll + # Calculate boards resulting from second move + nested_boards = [calc_moves(board, die) for board in boards] + #print("nested boards: ", nested_boards) + boards = [board for boards in nested_boards for board in boards] + # What the fuck + #for board in boards: + # print(board) + # print("type__:",type(board)) + # Add resulting unique boards to set of legal boards resulting from roll - #print("printing boards from calculate_legal_states: ", boards) + #print("printing boards from calculate_legal_states: ", boards) legal_moves = legal_moves | set(boards) # print("legal moves: ", legal_moves) if len(legal_moves) == 0: diff --git a/main.py b/main.py index a5fbf47..53b0444 100644 --- a/main.py +++ b/main.py @@ -205,7 +205,10 @@ if __name__ == "__main__": if not config['train_perpetually']: break - + elif args.play: + network = Network(config, config['model']) + network.play_against_network() + elif args.eval: network = Network(config, config['model']) for i in range(int(config['repeat_eval'])):