Closed
Description
In the function actions()
inside search.py, the variable index_blank_square
is a tuple
of indices, but called as a function like index_blank_square(0)
or index_blank_square(1)
.
def actions(self, state):
"""Return the actions that can be executed in the given state.
The result would be a list, since there are only four possible actions
in any given state of the environment."""
possible_actions = list()
index_blank_square = self.find_blank_square(state)
if index_blank_square(0) == 0:
possible_actions += ['DOWN']
elif index_blank_square(0) == 1:
possible_actions += ['UP', 'DOWN']
elif index_blank_square(0) == 2:
possible_actions += ['UP']
if index_blank_square(1) == 0:
possible_actions += ['RIGHT']
elif index_blank_square(1) == 1:
possible_actions += ['LEFT', 'RIGHT']
elif index_blank_square(1) == 2:
possible_actions += ['LEFT']
return possible_actions
Metadata
Metadata
Assignees
Labels
No labels