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

Method reward

rl/tic_tac_toe.py:147–154  ·  view source on GitHub ↗
(self, sym)

Source from the content-addressed store, hash-verified

145 return self.board[i,j] == 0
146
147 def reward(self, sym):
148 # no reward until game is over
149 if not self.game_over():
150 return 0
151
152 # if we get here, game is over
153 # sym will be self.x or self.o
154 return 1 if self.winner == sym else 0
155
156 def get_state(self):
157 # returns the current state, represented as an int

Callers 1

updateMethod · 0.45

Calls 1

game_overMethod · 0.95

Tested by

no test coverage detected