diff --git a/sources/Grid.py b/sources/Grid.py new file mode 100644 index 0000000..a718294 --- /dev/null +++ b/sources/Grid.py @@ -0,0 +1,6 @@ +__author__ = 'gaugendre' + + +class Grid: + def __init__(self): + pass \ No newline at end of file diff --git a/sources/Square.py b/sources/Square.py new file mode 100644 index 0000000..34de0df --- /dev/null +++ b/sources/Square.py @@ -0,0 +1,46 @@ +__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', ' ', ' '], + [' ', ' ', ' ', ' ']] +