MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / move

Method move

rl/grid_world.py:59–71  ·  view source on GitHub ↗
(self, action)

Source from the content-addressed store, hash-verified

57 return i, j
58
59 def move(self, action):
60 # check if legal move first
61 if action in self.actions[(self.i, self.j)]:
62 if action == 'U':
63 self.i -= 1
64 elif action == 'D':
65 self.i += 1
66 elif action == 'R':
67 self.j += 1
68 elif action == 'L':
69 self.j -= 1
70 # return a reward (if any)
71 return self.rewards.get((self.i, self.j), 0)
72
73 def undo_move(self, action):
74 # these are the opposite of what U/D/L/R should normally do

Callers 10

play_gameFunction · 0.45
play_gameFunction · 0.45
q_learning.pyFile · 0.45
td0_prediction.pyFile · 0.45
gather_samplesFunction · 0.45
gather_samplesFunction · 0.45
approx_control.pyFile · 0.45
sarsa.pyFile · 0.45
play_gameFunction · 0.45

Calls 1

getMethod · 0.80

Tested by

no test coverage detected