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

Method undo_move

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

Source from the content-addressed store, hash-verified

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
75 if action == 'U':
76 self.i += 1
77 elif action == 'D':
78 self.i -= 1
79 elif action == 'R':
80 self.j -= 1
81 elif action == 'L':
82 self.j += 1
83 # raise an exception if we arrive somewhere we shouldn't be
84 # should never happen
85 assert(self.current_state() in self.all_states())
86
87 def game_over(self):
88 # returns true if game is over, else false

Callers

nothing calls this directly

Calls 2

current_stateMethod · 0.95
all_statesMethod · 0.95

Tested by

no test coverage detected