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

Function initialV_x

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

Source from the content-addressed store, hash-verified

337
338
339def initialV_x(env, state_winner_triples):
340 # initialize state values as follows
341 # if x wins, V(s) = 1
342 # if x loses or draw, V(s) = 0
343 # otherwise, V(s) = 0.5
344 V = np.zeros(env.num_states)
345 for state, winner, ended in state_winner_triples:
346 if ended:
347 if winner == env.x:
348 v = 1
349 else:
350 v = 0
351 else:
352 v = 0.5
353 V[state] = v
354 return V
355
356
357def initialV_o(env, state_winner_triples):

Callers 1

tic_tac_toe.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected