Added network

This commit is contained in:
Alexander Munch-Hansen 2018-02-07 15:31:05 +01:00
parent fb3d822a86
commit c2118d0549
5 changed files with 18 additions and 8 deletions

View File

@ -91,11 +91,11 @@ class Board:
return """ return """
------------------------------------------------------------- ------------------------------------------------------------
|{12}|{11}|{10}|{9}|{8}|{7}|bar 1: {26} |{6}|{5}|{4}|{3}|{2}|{1}|end -1: {0}| |{12}|{11}|{10}|{9}|{8}|{7}|bar 1: {26} |{6}|{5}|{4}|{3}|{2}|{1}|end -1: {0}|
|--|--|--|--|--|--|--------|--|--|--|--|--|--| |--|--|--|--|--|--|--------|--|--|--|--|--|--|
|{13}|{14}|{15}|{16}|{17}|{18}|bar -1: {27} |{19}|{20}|{21}|{22}|{23}|{24}|end 1: {25}| |{13}|{14}|{15}|{16}|{17}|{18}|bar -1: {27} |{19}|{20}|{21}|{22}|{23}|{24}|end 1: {25}|
------------------------------------------------------------- ------------------------------------------------------------
""".format(*temp) """.format(*temp)
def move_to_jail(self,sym): def move_to_jail(self,sym):

3
bot.py
View File

@ -3,10 +3,11 @@ import random
class Bot: class Bot:
def __init__(self, board, sym): def __init__(self, board, sym, network):
self.cup = Cup() self.cup = Cup()
self.board = board self.board = board
self.sym = sym self.sym = sym
self.network = network
def roll(self): def roll(self):
print("{} rolled: ".format(self.sym)) print("{} rolled: ".format(self.sym))

View File

@ -1,13 +1,16 @@
from hooman import Human from hooman import Human
from board import Board from board import Board
from bot import Bot from bot import Bot
from network import Network
class Game: class Game:
def __init__(self): def __init__(self):
self.board = Board() self.board = Board()
self.p1 = Human(self.board, 1) self.network = Network()
self.p2 = Bot(self.board, -1) self.p1 = Human(self.board, 1, self.network)
self.p2 = Bot(self.board, -1, self.network)
def play(self): def play(self):
while True: while True:

View File

@ -5,8 +5,9 @@ class Human:
global cup global cup
cup = Cup() cup = Cup()
def __init__(self, board, sym): def __init__(self, board, sym, network):
self.cup = Cup() self.cup = Cup()
self.network = network
self.board = board self.board = board
self.sym = sym self.sym = sym

5
network.py Normal file
View File

@ -0,0 +1,5 @@
class Network:
def eval_state(self, state):
# Run state through a network
print("Network is evaluating")