mirror of
https://github.com/maoakeEnterprise/amazing.git
synced 2026-04-28 16:04:35 +02:00
starting mypy with maze
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
import numpy
|
||||
from numpy.typing import NDArray
|
||||
from typing import Optional, Any
|
||||
|
||||
|
||||
@dataclass
|
||||
class Maze:
|
||||
maze: numpy.ndarray
|
||||
maze: Optional[NDArray[Any]] = None
|
||||
|
||||
def get_maze(self) -> numpy.ndarray | None:
|
||||
def get_maze(self) -> Optional[NDArray[Any]]:
|
||||
return self.maze
|
||||
|
||||
def set_maze(self, new_maze: numpy.ndarray) -> None:
|
||||
def set_maze(self, new_maze: NDArray[Any]) -> None:
|
||||
self.maze = new_maze
|
||||
|
||||
def __str__(self) -> str:
|
||||
@@ -24,6 +24,9 @@ class Maze:
|
||||
return res
|
||||
|
||||
def ascii_print(self) -> None:
|
||||
if self.maze is None:
|
||||
print("None")
|
||||
return
|
||||
for cell in self.maze[0]:
|
||||
print("_", end="")
|
||||
if cell.get_north():
|
||||
|
||||
Reference in New Issue
Block a user