Added network
This commit is contained in:
parent
fb3d822a86
commit
c2118d0549
4
board.py
4
board.py
|
@ -91,11 +91,11 @@ class Board:
|
|||
|
||||
|
||||
return """
|
||||
-------------------------------------------------------------
|
||||
------------------------------------------------------------
|
||||
|{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}|
|
||||
-------------------------------------------------------------
|
||||
------------------------------------------------------------
|
||||
""".format(*temp)
|
||||
|
||||
def move_to_jail(self,sym):
|
||||
|
|
3
bot.py
3
bot.py
|
@ -3,10 +3,11 @@ import random
|
|||
|
||||
class Bot:
|
||||
|
||||
def __init__(self, board, sym):
|
||||
def __init__(self, board, sym, network):
|
||||
self.cup = Cup()
|
||||
self.board = board
|
||||
self.sym = sym
|
||||
self.network = network
|
||||
|
||||
def roll(self):
|
||||
print("{} rolled: ".format(self.sym))
|
||||
|
|
7
game.py
7
game.py
|
@ -1,13 +1,16 @@
|
|||
from hooman import Human
|
||||
from board import Board
|
||||
from bot import Bot
|
||||
from network import Network
|
||||
|
||||
class Game:
|
||||
|
||||
def __init__(self):
|
||||
self.board = Board()
|
||||
self.p1 = Human(self.board, 1)
|
||||
self.p2 = Bot(self.board, -1)
|
||||
self.network = Network()
|
||||
self.p1 = Human(self.board, 1, self.network)
|
||||
self.p2 = Bot(self.board, -1, self.network)
|
||||
|
||||
|
||||
def play(self):
|
||||
while True:
|
||||
|
|
|
@ -5,8 +5,9 @@ class Human:
|
|||
global cup
|
||||
cup = Cup()
|
||||
|
||||
def __init__(self, board, sym):
|
||||
def __init__(self, board, sym, network):
|
||||
self.cup = Cup()
|
||||
self.network = network
|
||||
self.board = board
|
||||
self.sym = sym
|
||||
|
||||
|
|
5
network.py
Normal file
5
network.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
class Network:
|
||||
|
||||
def eval_state(self, state):
|
||||
# Run state through a network
|
||||
print("Network is evaluating")
|
Loading…
Reference in New Issue
Block a user