Skip to content

Commit

Permalink
Merge pull request #55 from srajan-kiyotaka/sracho
Browse files Browse the repository at this point in the history
minor change in the methods of grid world.
  • Loading branch information
srajan-kiyotaka authored Jun 19, 2024
2 parents 84f0be5 + 77d8c54 commit cfb59cc
Show file tree
Hide file tree
Showing 7 changed files with 936 additions and 56 deletions.
8 changes: 4 additions & 4 deletions docs/gridWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ This method constructs the graphical user interface (GUI) representation of the

- `None`

### `addBlockPath(self, blockCells:setOfCoordinates)`
### `setBlockPath(self, blockCells:setOfCoordinates)`

Adds block cells to the world grid, which are cells that cannot be traversed by an agent. It takes a set of coordinates representing the block cells and visually updates the grid to reflect these changes by coloring the corresponding cells in red.
sets block cells to the world grid, which are cells that cannot be traversed by an agent. It takes a set of coordinates representing the block cells and visually updates the grid to reflect these changes by coloring the corresponding cells in red.

#### Parameters

Expand All @@ -81,9 +81,9 @@ Adds block cells to the world grid, which are cells that cannot be traversed by

- `None`

### `addGoalState(self, goalState:setOfCoordinates)`
### `setGoalState(self, goalState:setOfCoordinates)`

Adds goal cells to the world grid, which represents the target states an agent aims to reach. It takes a set of coordinates representing the goal cells and updates the grid by coloring these cells in green to visually differentiate them from other cells.
sets goal cells to the world grid, which represents the target states an agent aims to reach. It takes a set of coordinates representing the goal cells and updates the grid by coloring these cells in green to visually differentiate them from other cells.

#### Parameters

Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='TraverseCraft',
version='0.7.0',
version='0.7.5',
author='Srajan Chourasia, Varun Patrikar',
author_email='[email protected], [email protected]',
maintainer='Srajan Chourasia, Varun Patrikar',
Expand Down Expand Up @@ -34,13 +34,6 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Education',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
Expand Down
4 changes: 2 additions & 2 deletions src/traverseCraft/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def _startAgent(self):
agentThread.start()


def addBlockPath(self, blockCells:setOfCoordinates):
def setBlockPath(self, blockCells:setOfCoordinates):
"""
Adds block cells to the world grid.
Expand All @@ -299,7 +299,7 @@ def addBlockPath(self, blockCells:setOfCoordinates):
self._world[i][j] = -1


def addGoalState(self, goalState:setOfCoordinates):
def setGoalState(self, goalState:setOfCoordinates):
"""
Adds the goal state to the world grid.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_grid_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def setUp(self):
self.grid_world = CreateGridWorld(worldName='Test Grid', rows=10, cols=10, cellSize=20, pathColor="black", blockColor="pink", goalColor="aqua", cellPadding=4, borderWidth=2, buttonBgColor="#7FC8D9", buttonFgColor="#332942", textFont="Helvetica", textSize=20, textWeight="bold", buttonText="Test Start Agent", logoPath=None)

# Set goal state
self.grid_world.addGoalState([[5, 5], [6, 9], [8, 8]])
self.grid_world.setGoalState([[5, 5], [6, 9], [8, 8]])

# Set block state
self.grid_world.addBlockPath([[1, 1], [2, 2], [3, 3], [2, 7], [8, 5], [6, 1]])
self.grid_world.setBlockPath([[1, 1], [2, 2], [3, 3], [2, 7], [8, 5], [6, 1]])

# Construct the grid world
self.grid_world.constructWorld()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_grid_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def test_cells_not_none_and_bound(self):
block_path = [[1, 1], [2, 2], [3, 3], [2, 7], [8, 5], [6, 1]]

# Add the block path to the grid world
self.grid_world.addBlockPath(block_path)
self.grid_world.setBlockPath(block_path)

# Define the goal state to be added
goal_state = [[5, 5], [6, 9], [8, 8]]

# Add the goal state to the grid world
self.grid_world.addGoalState(goal_state)
self.grid_world.setGoalState(goal_state)

# Construct the grid world
self.grid_world.constructWorld()
Expand All @@ -80,7 +80,7 @@ def test_add_block_path(self):
block_path = [[1, 1], [2, 2], [3, 3], [2, 7], [8, 5], [6, 1]]

# Add the block path to the grid world
self.grid_world.addBlockPath(block_path)
self.grid_world.setBlockPath(block_path)

# Verify that the cells corresponding to the block path are set correctly
for coordinate in block_path:
Expand All @@ -98,7 +98,7 @@ def test_add_goal_state(self):
goal_state = [[5, 5], [6, 9], [8, 8]]

# Add the goal state to the grid world
self.grid_world.addGoalState(goal_state)
self.grid_world.setGoalState(goal_state)

# Verify that the cells corresponding to the goal state are set correctly
for coordinate in goal_state:
Expand Down
Loading

0 comments on commit cfb59cc

Please sign in to comment.