Added silent training
This commit is contained in:
+7
-7
@@ -122,7 +122,7 @@ class MachinePlayer(APlayer):
|
||||
def __init__(self, mark='X', with_debug=False, values=None):
|
||||
APlayer.__init__(self, mark)
|
||||
self.p_exp = 0.2
|
||||
self.alpha = 0.2
|
||||
self.alpha = 0.9
|
||||
self.with_debug = with_debug
|
||||
if values is None:
|
||||
self.values = {}
|
||||
@@ -179,7 +179,7 @@ class MachinePlayer(APlayer):
|
||||
self.state = self.state_from_move(state, move)
|
||||
|
||||
# Learn
|
||||
if not is_exp and self.state_last is not None:
|
||||
if not is_exp:
|
||||
v0 = self.get_value(self.state_last)
|
||||
v1 = self.get_value(self.state)
|
||||
d = max(0, v1-v0)
|
||||
@@ -246,16 +246,16 @@ def play(player_provider: PlayerProvider, k_max=10000, with_print=False):
|
||||
move += 1
|
||||
|
||||
|
||||
px = MachinePlayer(mark='X', with_debug=True)
|
||||
po = MachinePlayer(mark='O', with_debug=True)
|
||||
px = MachinePlayer(mark='X', with_debug=False)
|
||||
po = MachinePlayer(mark='O', with_debug=False)
|
||||
|
||||
do_training = 1
|
||||
if do_training:
|
||||
players = PlayerProvider(px, po)
|
||||
play(players, 10000, True)
|
||||
play(players, 20000, False)
|
||||
|
||||
#players = PlayerProvider(MachinePlayer(mark='X', with_debug=True, values=px.values), MachinePlayer(mark='O', with_debug=True, values=po.values))
|
||||
#play(players, 100, True)
|
||||
players = PlayerProvider(MachinePlayer(mark='X', with_debug=True, values=px.values), MachinePlayer(mark='O', with_debug=True, values=po.values))
|
||||
play(players, 100, True)
|
||||
|
||||
print("Testing")
|
||||
test_sample([0.7, 0.1, 0.1, 0.1])
|
||||
|
||||
Reference in New Issue
Block a user