MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / initialV_o

Function initialV_o

rl/tic_tac_toe.py:357–371  ·  view source on GitHub ↗
(env, state_winner_triples)

Source from the content-addressed store, hash-verified

355
356
357def initialV_o(env, state_winner_triples):
358 # this is (almost) the opposite of initial V for player x
359 # since everywhere where x wins (1), o loses (0)
360 # but a draw is still 0 for o
361 V = np.zeros(env.num_states)
362 for state, winner, ended in state_winner_triples:
363 if ended:
364 if winner == env.o:
365 v = 1
366 else:
367 v = 0
368 else:
369 v = 0.5
370 V[state] = v
371 return V
372
373
374def play_game(p1, p2, env, draw=False):

Callers 1

tic_tac_toe.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected