GenericAI_Sweeper/grid.py

55 lines
1.8 KiB
Python

from copy import copy, deepcopy
class Grid:
#def __init__(self, width, height, locationGrid=[[]], graph={}, translationGrid)=:
def __init__(self, width, height):
self.width = width
self.heigth = height
self.locationGrid = [[0 for x in range(width)] for y in range(height)]
#self.locationGrid = []
self.graph={}
self.translationGrid = [[0 for x in range(width)] for y in range(height)]
def fillTraslationGrid(self):
self.translationGrid[0] = ['0x0', '0x1', '0x2', '0x3', '0x4', '0x5']
self.translationGrid[1] = ['1x0', '1x1', '1x2', '1x3', '1x4', '1x5']
self.translationGrid[2] = ['2x0', '2x1', '2x2', '2x3', '2x4', '2x5']
self.translationGrid[3] = ['3x0', '3x1', '3x2', '3x3', '3x4', '3x5']
self.translationGrid[4] = ['4x0', '4x1', '4x2', '4x3', '4x4', '4x5']
self.translationGrid[5] = ['5x0', '5x1', '5x2', '5x3', '5x4', '5x5']
def fillLocationGrid(self):
pass
"""self.locationGrid[0] =
self.locationGrid[1] =
self.locationGrid[2] =
self.locationGrid[3] =
self.locationGrid[4] =
self.locationGrid[5] = """
def printLocationGrid(self):
for r in self.locationGrid:
for c in r:
print(c, end = " ")
print()
def copyLocationGrid(self, x):
self.locationGrid = deepcopy(x)
def printTranslationGrid(self):
for r in self.translationGrid:
for c in r:
print(c, end = " ")
print()
def printGraph(self):
print(self.graph)
def setLocationGridCell(self, x, y, value):
self.locationGrid[x][y] = value
def setTranslationGridCell(self, x, y, value):
self.translationGrid[x][y] = value