Skip to content
Snippets Groups Projects
Commit 28573bc8 authored by sabriansam96's avatar sabriansam96
Browse files

Fixed Simulation Class

parent 26fde6b9
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,9 @@ class Simulation: ...@@ -62,7 +62,9 @@ class Simulation:
self.fig = fig self.fig = fig
self.ax = ax self.ax = ax
self.board_shape = game.board().shape self.board_shape = game.board().shape
self.p = self.ax.imshow(np.zeros_like(game.board()), cmap = plt.cm.gray_r, interpolation='None', extent=[0, self.board_shape[1], 0, self.board_shape[0]]) self.p = self.ax.imshow(np.zeros_like(game.board()), \
cmap = plt.cm.gray_r, interpolation='None', \
extent=[0, self.board_shape[1], 0, self.board_shape[0]])
def __call__(self, iterations: int): def __call__(self, iterations: int):
""" """
...@@ -81,15 +83,19 @@ class Simulation: ...@@ -81,15 +83,19 @@ class Simulation:
plt.title('Game Of Life') plt.title('Game Of Life')
# Show grid lines # Show grid lines
plt.grid(which='both', linestyle='--') plt.grid(which='both', linestyle='--')
plt.xticks(ticks=[i for i in range(self.board_shape[0])], labels=[' ' for i in range(self.board_shape[0])]) plt.xticks(ticks=[i for i in range(self.board_shape[0])], \
plt.yticks(ticks=[i for i in range(self.board_shape[1])], labels=[' ' for i in range(self.board_shape[1])]) labels=[' ' for i in range(self.board_shape[0])])
plt.yticks(ticks=[i for i in range(self.board_shape[1])], \
labels=[' ' for i in range(self.board_shape[1])])
plt.show() plt.show()
return a return a
def _init(self): def _init(self):
self.p = self.ax.imshow(self.game.board(), cmap = plt.cm.gray_r, interpolation='None', extent=[0, self.board_shape[1], 0, self.board_shape[0]]) self.p = self.ax.imshow(self.game.board(), \
cmap = plt.cm.gray_r, interpolation='None', \
extent=[0, self.board_shape[1], 0, self.board_shape[0]])
return (self.p,) return (self.p,)
def _render(self, i): def _render(self, i):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment