def test_get_unmarked_positions(self): ttb = TicTacToeBoard() expected_positions = [ XYLocation(0, 0), XYLocation(0, 1), XYLocation(0, 2), XYLocation(1, 0), XYLocation(1, 1), XYLocation(1, 2), XYLocation(2, 0), XYLocation(2, 1), XYLocation(2, 2) ] self.assertSameElements(expected_positions, ttb.get_unmarked_positions()) ttb.markO(1, 2) ttb.markX(0, 0) ttb.markO(2, 2) expected_positions = [ XYLocation(0, 1), XYLocation(0, 2), XYLocation(1, 0), XYLocation(1, 1), XYLocation(1, 2), XYLocation(2, 0) ] self.assertSameElements(expected_positions, ttb.get_unmarked_positions())
def test_is_any_row_complete(self): ttb = TicTacToeBoard() self.assertFalse(ttb.is_diagonal_complete()) ttb.markX(0, 0) ttb.markX(1, 0) ttb.markX(2, 0) self.assertTrue(ttb.is_any_column_complete()) ttb.markO(1, 0) self.assertFalse(ttb.is_any_column_complete())
def test_is_any_row_complete(self): ttb = TicTacToeBoard() self.assertFalse(ttb.is_diagonal_complete()) ttb.markX(0, 0) ttb.markX(1, 0) ttb.markX(2, 0) self.assertTrue(ttb.is_any_column_complete()) ttb.markO(1, 0) self.assertFalse(ttb.is_any_column_complete())
def test_get_unmarked_positions(self): ttb = TicTacToeBoard() expected_positions = [XYLocation(0, 0), XYLocation(0, 1), XYLocation(0, 2), XYLocation(1, 0), XYLocation(1, 1), XYLocation(1, 2), XYLocation(2, 0), XYLocation(2, 1), XYLocation(2, 2)] self.assertSameElements(expected_positions, ttb.get_unmarked_positions()) ttb.markO(1, 2) ttb.markX(0, 0) ttb.markO(2, 2) expected_positions = [ XYLocation(0, 1), XYLocation(0, 2), XYLocation(1, 0), XYLocation(1, 1), XYLocation(1, 2), XYLocation(2, 0)] self.assertSameElements(expected_positions, ttb.get_unmarked_positions())