Grossteil vom GUI vom Minesweeper porten, muss noch fertiggestellt werden

This commit is contained in:
Alfred Baumann
2026-05-14 20:31:22 +02:00
parent 162a2ca1a3
commit f6c5a98624
11 changed files with 98 additions and 10 deletions

View File

@@ -15,10 +15,10 @@ class PieceType(IntEnum):
class Direction(IntEnum):
UP = auto()
LEFT = auto()
DOWN = auto()
UP = 0
RIGHT = auto()
DOWN = auto()
LEFT = auto()
@staticmethod
def from_offset(dx: int, dy: int) -> Direction:
@@ -139,10 +139,12 @@ class Grid:
dx = x - nx
dy = y - ny
if (
Direction.from_offset(-dx, -dy)
in self.pieces[x + dx][y + dy].connected_directions()
Direction.from_offset(dx, dy)
in self.pieces[nx][ny].connected_directions()
and Direction.from_offset(-dx, -dy)
in self.pieces[x][y].connected_directions()
):
connectedNeighbors.append((x + dx, y + dy))
connectedNeighbors.append((nx, ny))
for nx, ny in connectedNeighbors:
if connected[nx][ny]:
@@ -172,7 +174,3 @@ class NetGame:
def solved(self):
return self._grid.solved()
g = NetGame(5, 5)
print(g.solved())