Loading pythonsnake/candy.py +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ from pythonsnake.snake import Snake class Candy: def __init__(self, grid_width: int, grid_height: int, snake: Snake) -> None: def __init__(self, grid_width: int, grid_height: int, snake: Snake) -> None: self.X = 0 self.Y = 0 self.random_coord(grid_width, grid_height, snake) Loading pythonsnake/snake.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class Snake: "y": snake_to_shift[i - 1]["y"], } if self.piece_pending != None: if self.piece_pending is not None: self.coord.append( {"x": self.piece_pending["x"], "y": self.piece_pending["y"]} ) Loading pythonsnake/terminalview.py +7 −5 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ class TerminalView: os.system("cls" if os.name == "nt" else "clear") def display_grid(self, gameState: Game) -> None: if(self.in_progress == True): if (self.in_progress is True): return None self.in_progress = True Loading @@ -29,12 +29,12 @@ class TerminalView: grid_to_print += "|" # display user if column["snake"] == True: if column["snake"] is True: grid_to_print += ( terminalColor.OKGREEN + "X" + terminalColor.ENDC ) # display candy except if same coord as player elif column["candy"] == True: elif column["candy"] is True: grid_to_print += ( terminalColor.OKBLUE + "O" + terminalColor.ENDC ) Loading Loading @@ -93,5 +93,7 @@ class TerminalView: def menu_choice_incorrect(self) -> None: print( terminalColor.FAIL, "le choix n'est pas correct", terminalColor.ENDC terminalColor.FAIL, "le choix n'est pas correct", terminalColor.ENDC ) Loading
pythonsnake/candy.py +3 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,9 @@ from pythonsnake.snake import Snake class Candy: def __init__(self, grid_width: int, grid_height: int, snake: Snake) -> None: def __init__(self, grid_width: int, grid_height: int, snake: Snake) -> None: self.X = 0 self.Y = 0 self.random_coord(grid_width, grid_height, snake) Loading
pythonsnake/snake.py +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class Snake: "y": snake_to_shift[i - 1]["y"], } if self.piece_pending != None: if self.piece_pending is not None: self.coord.append( {"x": self.piece_pending["x"], "y": self.piece_pending["y"]} ) Loading
pythonsnake/terminalview.py +7 −5 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ class TerminalView: os.system("cls" if os.name == "nt" else "clear") def display_grid(self, gameState: Game) -> None: if(self.in_progress == True): if (self.in_progress is True): return None self.in_progress = True Loading @@ -29,12 +29,12 @@ class TerminalView: grid_to_print += "|" # display user if column["snake"] == True: if column["snake"] is True: grid_to_print += ( terminalColor.OKGREEN + "X" + terminalColor.ENDC ) # display candy except if same coord as player elif column["candy"] == True: elif column["candy"] is True: grid_to_print += ( terminalColor.OKBLUE + "O" + terminalColor.ENDC ) Loading Loading @@ -93,5 +93,7 @@ class TerminalView: def menu_choice_incorrect(self) -> None: print( terminalColor.FAIL, "le choix n'est pas correct", terminalColor.ENDC terminalColor.FAIL, "le choix n'est pas correct", terminalColor.ENDC )