I'm fairly new to python and I'm having trouble passing in a Cell
object through a Block
init
function. I am making a 9x9
grid with 81 cell objects, and every "block" is a 3x3
grid of cells. (like a sudoku board) I am trying to separate the "blocks" in order to analyze whether the block consists of all 1:9 integers. I've successfully made the "grid" (more or less) and now I need to separate the grid into blocks. any help is appreciated!
class Block:
def __init__(self, block_coord =(0,0),block_values = (This should be a 3x3 list of cell objects):
self.block_coord = block_coord
self.block_values = block_values
class Cell:
def __init__(self, cell_coord = (0,0), cell_value = 1.0):
#stores the coordinate of the cell
self.cell_coord = cell_coord
#stores the value of the cell
self.cell_value = cell_value
def __call__(self):
return Cell(self.cell_coord,self.cell_value)
def getCoordinate (self):
return self.cell_coord
def getValue (self):
return self.cell_value
def setValue(self,set_value = 1.0):
self.cell_value = set_value
def setCoordinate(self,set_coordinate = (0,0)):
self.cell_coord = set_coordinate