From ea4efc5a2bd660214a2c4f2a92f77875d28b7b7f Mon Sep 17 00:00:00 2001 From: Alexander Munch-Hansen Date: Thu, 7 Jun 2018 21:36:06 +0200 Subject: [PATCH] Updated server code. --- app.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index a605180..a119bbe 100644 --- a/app.py +++ b/app.py @@ -2,6 +2,7 @@ from flask import Flask, request, jsonify from flask_json import FlaskJSON, as_json_p from flask_cors import CORS from board import Board +from eval import Eval import main import random from network import Network @@ -17,8 +18,8 @@ CORS(app) config = main.config.copy() config['model'] = "player_testings" -config['ply'] = "1" -config['board_representation'] = 'quack-fat' +config['ply'] = "0" +config['board_representation'] = 'tesauro' network = Network(config, config['model']) network.restore_model() @@ -90,11 +91,16 @@ def bot_move(): data = request.get_json(force=True) board = [int(x) for x in data['board'].split(',')] + use_pubeval = bool(data['pubeval']) - roll = (random.randrange(1,7), random.randrange(1,7)) - # print(roll) - board, _ = network.make_move(tuple(board), roll, 1) - # print("Boards!:",board) + roll = (random.randrange(1, 7), random.randrange(1, 7)) + + if use_pubeval: + board, value = Eval.make_pubeval_move(tuple(board), 1, roll) + else: + board, _ = network.make_move(tuple(board), roll, 1) + + # print("Board!:",board) return ",".join([str(x) for x in list(board)])