Skip to content

Commit

Permalink
Savepoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
skytreader committed Mar 1, 2018
1 parent da8c418 commit 2990fa1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 6 additions & 2 deletions algorithms/grids/grid_model.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from components.core import GameModel
from components.helpers.grid import BorderProperties, QuadraticGrid

class Grid(GameModel):

FREE = True
BLOCKED = False

def __init__(self, width, height):
self.qg = QuadraticGrid(width, height, diag_neighbors=False)
def __init__(self, grid_size):
self.qg = QuadraticGrid(
grid_size[0], grid_size[1], diag_neighbors=False,
border_properties=BorderProperties()
)
for i in range(width):
for j in range(height):
self.qg.grid[i][j] = FREE
Expand Down
11 changes: 11 additions & 0 deletions algorithms/grids/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from components.core import GameConfig, GameLoopEvents, GameLoop
from grid_model import Grid
from screen import GridScreen

if __name__ == "__main__":
config = GameConfig()
model = Grid((10, 10))
screen = GridScreen(config, model)
loop_events = GameLoopEvents(config, screen)
loop = GameLoop(loop_events)
loop.go()
4 changes: 3 additions & 1 deletion algorithms/grids/screen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from components.core import GameScreen

class GridScreen(GameScreen):
pass

def __init__(self, config, model):
super(GridScreen, self).__init__(config, model)

0 comments on commit 2990fa1

Please sign in to comment.