sudoku-solver/square.py

27 lines
764 B
Python
Raw Normal View History

2019-11-30 13:55:22 +01:00
"""This module contains the Square class."""
class Square:
"""A Square object represents a square on the board.
The square's content will consist of a set of possible values for that
square.
The grid attribute identifies in which 9x9 grid the square belongs to.
"""
def __init__(self, line, column, content):
self.line = line
self.column = column
self.grid = self.compute_grid()
self.coordinates = (self.line, self.column)
self.content = content
def compute_grid(self):
"""Given the coordinates, determine which grid the Square belongs to.
The grids are numbered from 0 to 8, in the following configuration:
0 1 2
3 4 5
6 7 8
"""