def test8(self): print("\n") m = [[1, 0, 0, 0], [1, 0, 0, 1], [1, 0, 1, 1], [0, 1, 0, 0]] square = Square(m) square.print() s = square.get() print(s) self.assertEqual(s, 0)
def test14(self): print("\n") m = [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]] square = Square(m) square.print() s = square.get() print(s) self.assertEqual(s, 16)
def test3(self): print() m = [[1, 0, 0, 0, 1], [1, 0, 1, 1, 1], [0, 0, 1, 1, 1], [1, 0, 1, 1, 1]] square = Square(m) square.print() s = square.get() print(s) self.assertEqual(s, 9)
def setup_board(self): ''' Creating 64 instances of class Squares as self attributes. (Another alternative was to create a dictionary) ''' for rank in type(self).RANKS: for file in type(self).FILES: setattr(self, f"{type(self).FILES_MAPPING[file]}{rank}", Square(file, rank))
def format_board(self): """ Method that format board to have 10 lists with Square object as items """ self.board = [] for i in range(0, 10): self.board.append([]) for j in range(0, 10): self.board[i].append(Square(i, j)) self.board[i].append("\n")
def load_squares(self): for i in range(0, 400): file_name = './res/cropped/square_' + str(i) + '.png' img = Image.open(file_name) self.squares.append(Square(i, img))