]> Untitled Git - axy/ft/a-maze-ing.git/commitdiff
Refactor part two
authorAxy <gilliardmarthey.axel@gmail.com>
Mon, 23 Mar 2026 02:26:29 +0000 (03:26 +0100)
committerAxy <gilliardmarthey.axel@gmail.com>
Mon, 23 Mar 2026 02:26:29 +0000 (03:26 +0100)
__main__.py
amazeing/__init__.py
amazeing/display/__init__.py [new file with mode: 0644]
amazeing/display/layout.py [moved from amazeing/maze_display/layout.py with 100% similarity]
amazeing/display/tty.py [moved from amazeing/maze_display/TTYdisplay.py with 99% similarity]
amazeing/maze/__init__.py
amazeing/maze/maze_make_empty.py [moved from amazeing/maze_make_empty.py with 100% similarity]
amazeing/maze/maze_make_pacman.py [moved from amazeing/maze_make_pacman.py with 100% similarity]
amazeing/maze/maze_make_perfect.py [moved from amazeing/maze_make_perfect.py with 100% similarity]
amazeing/maze_display/__init__.py [deleted file]
amazeing/maze_display/backend.py [deleted file]

index 963a1b106d726e1b198f86b7e50acc1678d54202..348fd2821bf86d4d6aab63805f98d6305d680b82 100644 (file)
@@ -1,11 +1,9 @@
 import time
-from amazeing import (
+from amazeing.maze import (
     Maze,
-    TTYBackend,
     Pattern,
-    maze_make_pacman,
-    maze_make_perfect,
 )
+from amazeing.display import TTYBackend
 import random
 
 
@@ -15,8 +13,10 @@ from amazeing.maze import (
     CellCoord,
     MazeDirtyTracker,
     MazePacmanTracker,
+    maze_make_pacman,
+    maze_make_perfect,
 )
-from amazeing.maze_display.TTYdisplay import TileCycle, TileMaps, extract_pairs
+from amazeing.display import TileCycle, TileMaps, extract_pairs
 from amazeing.utils import IVec2
 
 config = Config.parse(open("./example.conf").read())
index b0d39187e8e2874ac9d94372201568a463a548bd..945cf3a095cc8bc953a5b3a96596916a43d0750d 100644 (file)
@@ -1,21 +1,2 @@
 __version__ = "0.0.0"
 __author__ = "luflores & agilliar"
-
-
-from .maze.maze_coords import WallCoord
-from .maze.maze import Maze
-from .maze.maze_pattern import Pattern
-from .maze_display.TTYdisplay import TTYBackend
-from .maze_make_empty import maze_make_empty
-from .maze_make_perfect import maze_make_perfect
-from .maze_make_pacman import maze_make_pacman
-
-__all__ = [
-    "Maze",
-    "WallCoord",
-    "TTYBackend",
-    "Pattern",
-    "maze_make_empty",
-    "maze_make_perfect",
-    "maze_make_pacman",
-]
diff --git a/amazeing/display/__init__.py b/amazeing/display/__init__.py
new file mode 100644 (file)
index 0000000..6864f07
--- /dev/null
@@ -0,0 +1,6 @@
+__version__ = "0.0.0"
+__author__ = "luflores & agilliar"
+
+from .tty import TTYBackend, TileCycle, TileMaps, extract_pairs
+
+__all__ = ["TTYBackend", "TileCycle", "TileMaps", "extract_pairs"]
similarity index 99%
rename from amazeing/maze_display/TTYdisplay.py
rename to amazeing/display/tty.py
index ad6b08aae1a626babc2a409c7416a9635f42d9a6..d1429863b8cec3b76e1856a40afb20fd1cf69ed3 100644 (file)
@@ -3,7 +3,7 @@ from collections.abc import Callable, Generator, Iterable
 from dataclasses import dataclass
 from amazeing.utils import BiMap
 from amazeing.config.config_parser import Color, Config, ColoredLine, ColorPair
-from amazeing.maze_display.layout import (
+from amazeing.display.layout import (
     BInt,
     Box,
     DBox,
index 59f7cbf6d28e0bc4467d5ff762f677d248e754b6..e7ab7b7710080188d0a091aaa19b6a73f7a870b0 100644 (file)
@@ -6,6 +6,9 @@ from .maze_coords import Cardinal, Orientation, WallCoord, CellCoord
 from .maze_dirty_tracker import MazeDirtyTracker
 from .maze_pacman_tracker import MazePacmanTracker
 from .maze_network_tracker import MazeNetworkTracker
+from .maze_make_empty import maze_make_empty
+from .maze_make_pacman import maze_make_pacman
+from .maze_make_perfect import maze_make_perfect
 
 __all__ = [
     "Maze",
@@ -17,4 +20,7 @@ __all__ = [
     "MazeDirtyTracker",
     "MazePacmanTracker",
     "MazeNetworkTracker",
+    "maze_make_empty",
+    "maze_make_pacman",
+    "maze_make_perfect",
 ]
diff --git a/amazeing/maze_display/__init__.py b/amazeing/maze_display/__init__.py
deleted file mode 100644 (file)
index 33dd123..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-__version__ = "0.0.0"
-__author__ = "luflores & agilliar"
-
-__all__ = []
diff --git a/amazeing/maze_display/backend.py b/amazeing/maze_display/backend.py
deleted file mode 100644 (file)
index fc0ee68..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-from collections.abc import Callable
-from typing import Type, cast
-
-
-class IVec2[T = int]:
-    def copy(self, inner_copy: Callable[[T], T] = lambda e: e) -> "IVec2[T]":
-        return IVec2(inner_copy(self.x), inner_copy(self.y))
-
-    def __init__(self, x: T, y: T) -> None:
-        self.x: T = x
-        self.y: T = y
-
-    @staticmethod
-    def splat(n: T) -> "IVec2[T]":
-        return IVec2(n, n)
-
-    def __repr__(self) -> str:
-        return f"{self.x, self.y}"
-
-    @staticmethod
-    def with_op[T2](
-        op: Callable[[T, T], T2],
-    ) -> Callable[["IVec2[T]", "T | IVec2[T]"], "IVec2[T2]"]:
-        return lambda self, other: IVec2(
-            op(
-                self.x,
-                (
-                    other
-                    if isinstance(other, IVec2)
-                    else (other := type(self).splat(other))
-                ).x,
-            ),
-            op(self.y, cast(IVec2[T], other).y),
-        )
-
-    def innertype(self) -> Type[T]:
-        return type(self.x)
-
-    def __mul__(self, other: "IVec2[T]") -> "IVec2[T]":
-        return IVec2(self.x * other.x, self.y * other.y)  # type:ignore
-
-    def __add__(self, other: "IVec2[T]") -> "IVec2[T]":
-        return IVec2(self.x + other.x, self.y + other.y)  # type:ignore
-
-    def __sub__(self, other: "IVec2[T]") -> "IVec2[T]":
-        return IVec2(self.x - other.x, self.y - other.y)  # type:ignore
-
-    def __floordiv__(self, other: "IVec2[T]") -> "IVec2[T]":
-        return IVec2(self.x // other.x, self.y // other.y)  # type:ignore
-
-    def __mod__(self, other: "IVec2[T]") -> "IVec2[T]":
-        return IVec2(self.x % other.x, self.y % other.y)  # type:ignore
-
-    def __eq__(self, value: object, /) -> bool:
-        return (
-            isinstance(value, IVec2)
-            and self.x == value.x
-            and self.y == value.y
-        )
-
-    def __hash__(self) -> int:
-        return hash((self.x, self.y))
-
-    def xy(self) -> tuple[T, T]:
-        return (self.x, self.y)
-
-    def yx(self) -> tuple[T, T]:
-        return (self.y, self.x)