- bugfix not rewarding properly
- bugfix not set value properly after learn
This commit is contained in:
+7
-7
@@ -41,17 +41,17 @@ def play(player_provider: PlayerProvider, k_max=10000, with_debug=False):
|
||||
if with_debug:
|
||||
print(to_state_string(last_state, state))
|
||||
if not has_moved:
|
||||
player.end_game(state, 0.0)
|
||||
other_player.end_game(state, 0.0)
|
||||
run = False
|
||||
if with_debug:
|
||||
print(f"{player.mark}: No more moves")
|
||||
player.end_game(state, 0.0)
|
||||
other_player.end_game(state, 0.0)
|
||||
run = False
|
||||
if player.has_won(state):
|
||||
player.end_game(state, 1.0)
|
||||
other_player.end_game(state, 0.0)
|
||||
run = False
|
||||
if with_debug:
|
||||
print(f"{player.mark}: Has won the game")
|
||||
player.end_game(state, 1.0)
|
||||
other_player.end_game(state, 0.0)
|
||||
run = False
|
||||
|
||||
other_player = player
|
||||
if not run:
|
||||
@@ -83,7 +83,7 @@ p_mx = MachinePlayer(mark='X', params=MachinePlayer.Params(p_explore=0.1, alpha=
|
||||
p_mo = MachinePlayer(mark='O', params=MachinePlayer.Params(p_explore=0.1, alpha=0.1), values=o_values)
|
||||
|
||||
if do_training:
|
||||
play(PlayerProvider(p_mx, p_mo), 50000, False)
|
||||
play(PlayerProvider(p_mx, p_mo), 5000, False)
|
||||
|
||||
# Values after training
|
||||
# Convert and write JSON object to file
|
||||
|
||||
Reference in New Issue
Block a user