Updated server code.
This commit is contained in:
parent
26c0b469eb
commit
ea4efc5a2b
14
app.py
14
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)
|
||||
|
||||
if use_pubeval:
|
||||
board, value = Eval.make_pubeval_move(tuple(board), 1, roll)
|
||||
else:
|
||||
board, _ = network.make_move(tuple(board), roll, 1)
|
||||
# print("Boards!:",board)
|
||||
|
||||
# print("Board!:",board)
|
||||
|
||||
return ",".join([str(x) for x in list(board)])
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user