Skip to content

Commit

Permalink
- deleted set up grid. realized it gets over written by fill grid.
Browse files Browse the repository at this point in the history
 - created population function in board class
  • Loading branch information
tripplerizz committed Apr 1, 2020
1 parent ac1c016 commit b308536
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,21 @@ def movePos(self,x,y): # this function is tied to move function



def move(self):
def move(self, cellDict):


x = self.Row + (random.randint(-1,1))
y = self.Column + (random.randint(-1,1))

while(self.gameBoard[x,y] != 0):
self.collision()
if cellDict[x,y].infectionStatus == 2:
self.collision()

x = self.Row + (random.randint(-1,1))
y = self.Column + (random.randint(-1,1))

self.setPos(x, y)


def collision(self):
if(self.infectionStatus == 1):
Expand Down
2 changes: 1 addition & 1 deletion GameBoard.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def update_grid(self):
if (x, y) in self.cell_dict:
popped_cell = self.cell_dict.pop((x, y))
self.grid[x][y] = 0
popped_cell.move() # call move on cell
popped_cell.move(self.cell_dict) # call move on cell
self.cell_dict[popped_cell.Row, popped_cell.Column] = popped_cell
self.grid[popped_cell.Row][popped_cell.Column] = popped_cell.infectionStatus

Expand Down

0 comments on commit b308536

Please sign in to comment.