Removed useless call to super().__init__() in Cell.__init__()
This commit is contained in:
@@ -17,7 +17,7 @@ class Colors(Enum):
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Render_Info:
|
class Render_Info:
|
||||||
screen_dimensions: XYPair = XYPair(300,300)
|
screen_dimensions: XYPair = XYPair(1000,1000)
|
||||||
padding: XYPair = XYPair(1, 1)
|
padding: XYPair = XYPair(1, 1)
|
||||||
background_color = Colors.BLACK.value
|
background_color = Colors.BLACK.value
|
||||||
|
|
||||||
@@ -38,7 +38,6 @@ class Cell:
|
|||||||
calculate_spacing(self.position.y, self.dimensions.y, padding.y))
|
calculate_spacing(self.position.y, self.dimensions.y, padding.y))
|
||||||
|
|
||||||
def __init__(self, position: XYPair, dimensions: XYPair, render_info: Render_Info, state: CellStates=CellStates.DEAD) -> None:
|
def __init__(self, position: XYPair, dimensions: XYPair, render_info: Render_Info, state: CellStates=CellStates.DEAD) -> None:
|
||||||
super().__init__()
|
|
||||||
self.crowding_number = 0
|
self.crowding_number = 0
|
||||||
self.position = position
|
self.position = position
|
||||||
self.dimensions = dimensions
|
self.dimensions = dimensions
|
||||||
@@ -130,6 +129,7 @@ class Board:
|
|||||||
cell.draw(screen)
|
cell.draw(screen)
|
||||||
|
|
||||||
def handle_click(self, mouse_pos, render_info):
|
def handle_click(self, mouse_pos, render_info):
|
||||||
|
|
||||||
def pixel_to_index(x, w, p):
|
def pixel_to_index(x, w, p):
|
||||||
return floor((x - p)/(w + 2*p))
|
return floor((x - p)/(w + 2*p))
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ class Board:
|
|||||||
def main():
|
def main():
|
||||||
render_info: Render_Info = Render_Info()
|
render_info: Render_Info = Render_Info()
|
||||||
screen = pygame.display.set_mode(render_info.screen_dimensions)
|
screen = pygame.display.set_mode(render_info.screen_dimensions)
|
||||||
board = Board(XYPair(20, 20), render_info)
|
board = Board(XYPair(50, 50), render_info)
|
||||||
pygame.display.set_caption("Conway's Game of Life")
|
pygame.display.set_caption("Conway's Game of Life")
|
||||||
|
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|||||||
Reference in New Issue
Block a user