Skip to content
Snippets Groups Projects
Commit dcca1944 authored by Tessaris Sergio's avatar Tessaris Sergio
Browse files

fix: spelling typos

parent 12d24bb1
No related branches found
No related tags found
No related merge requests found
......@@ -123,7 +123,7 @@ class GridWorld(object):
def from_string(cls, world_desc: str) -> 'GridWorld':
"""Create a new grid world from a string describing the layout.
Each line corresponds to a different row, and #s represent the position of a block, while any othe character is interpreted as an empty square. The size of the world is the number of lines (height) and the size of the longest line (width). E.g.:
Each line corresponds to a different row, and #s represent the position of a block, while any other character is interpreted as an empty square. The size of the world is the number of lines (height) and the size of the longest line (width). E.g.:
....#
#....
......@@ -138,7 +138,7 @@ class GridWorld(object):
@staticmethod
def find_coordinates(items: str, world_desc: Union[str, Iterable[str]]):
"""Return all the coordinates in which any of the characters appears in the world description. The decription can be a multiline string or the list of lines."""
"""Return all the coordinates in which any of the characters appears in the world description. The description can be a multiline string or the list of lines."""
coordinates = []
rows = world_desc.splitlines() if isinstance(world_desc, str) else world_desc
y = -1
......@@ -260,7 +260,7 @@ class GridWorld(object):
return top_frame + "\n".join(reversed([side_frame + ''.join(maze_strs[i]) + side_frame for i in range(self.size.y)])) + bottom_frame
def run_episode(self, agent: Agent, player: 'Player', horizon: int = 0, show=True):
"""Run an episode on the world using the player to control the agent. The horizon specifies the maximun number of steps, 0 or None means no limit. If show is true then the world is printed ad each iteration before the player's turn.
"""Run an episode on the world using the player to control the agent. The horizon specifies the maximum number of steps, 0 or None means no limit. If show is true then the world is printed ad each iteration before the player's turn.
Raise the exception GridWorldException is the agent is not in the world."""
if agent not in self.objects:
......@@ -270,7 +270,7 @@ class GridWorld(object):
step = 0
while not horizon or step < horizon:
if agent.success():
print('The agent {} succeded!'.format(agent.name))
print('The agent {} succeeded!'.format(agent.name))
break
if not agent.isAlive:
print('The agent {} died!'.format(agent.name))
......@@ -288,7 +288,7 @@ class GridWorld(object):
step += 1
else:
print('Episode terminated by maximun number of steps ({}).'.format(horizon))
print('Episode terminated by maximum number of steps ({}).'.format(horizon))
player.end_episode()
......@@ -390,7 +390,7 @@ class UserPlayer(Player):
if len(options) == 1:
return actions_dict[options[0]]
else:
print('Canot understand <{}>'.format(answer))
print('Cannot understand <{}>'.format(answer))
def feedback(self, action: Agent.Actions, reward: int, state):
print('{}: action {} reward is {}'.format(self.name, action.name, reward))
......@@ -455,7 +455,7 @@ class SimpleEater(Agent):
def eaterWorld(map_desc: str, foods: Iterable[Coordinate] = [], food_amount: float = .1) -> GridWorld:
"""Create a new world using the decription and placing food in the given list foods or randomly placing a food_amount (if greater than zero) or the percentage of free cells otherwise number foods."""
"""Create a new world using the description and placing food in the given list foods or randomly placing a food_amount (if greater than zero) or the percentage of free cells otherwise number foods."""
world = GridWorld.from_string(map_desc)
if len(foods) > 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment