brute-force
This commit is contained in:
11
src/net.py
11
src/net.py
@@ -7,8 +7,6 @@ from random import choice
|
||||
from src.interface import parse_description
|
||||
from src.netTypes import Piece, Direction, Coordinate
|
||||
|
||||
DEMO_FIELD = parse_description("5x5:c7634887c213e5b8db3e69282")
|
||||
|
||||
|
||||
class Grid:
|
||||
pieces: list[list[Piece]]
|
||||
@@ -70,9 +68,13 @@ class Grid:
|
||||
|
||||
class NetGame:
|
||||
_grid: Grid
|
||||
width: int
|
||||
height: int
|
||||
|
||||
def __init__(self, width: int, height: int) -> None:
|
||||
self._grid = Grid(width, height)
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
def get_field(self) -> list[list[Piece]]:
|
||||
return self._grid.pieces
|
||||
@@ -85,9 +87,12 @@ class NetGame:
|
||||
|
||||
def turn_ccw(self, x: int, y: int) -> None:
|
||||
self._grid.pieces[x][y].turn_ccw()
|
||||
|
||||
|
||||
def lock(self, x: int, y: int) -> None:
|
||||
self._grid.pieces[x][y].locked = not self._grid.pieces[x][y].locked
|
||||
|
||||
def set_direction(self, x: int, y: int, dir: Direction) -> None:
|
||||
self._grid.pieces[x][y].direction = dir
|
||||
|
||||
def solved(self):
|
||||
return self._grid.solved()
|
||||
|
||||
Reference in New Issue
Block a user