__author__ = 'gaugendre' class Square: """ Represents a square in the grid. A square can be either Red, Blue, or Nothing, depending on the text written in it and displayed ('R', 'B' or ' '). """ def __init__(self, horiz, vert): self.horiz = horiz self.vert = vert def get_next_horiz(self): return Square(self.horiz + 1, self.vert) def get_prev_horiz(self): return Square(self.horiz - 1, self.vert) def get_next_vert(self): return Square(self.horiz, self.vert + 1) def get_prev_vert(self): return Square(self.horiz, self.vert - 1) def __eq__(self, other): if other is None or not isinstance(other, Square): return False else: return self.vert == other.vert and self.horiz == other.horiz def __hash__(self): return hash((self.horiz, self.vert)) def solve(grid): for char in grid: pass grid = [['R', ' ', ' ', 'R'], ['R', ' ', 'B', ' '], [' ', 'R', ' ', ' '], [' ', ' ', ' ', ' ']]