Beispiel #1
0
    def test_initial_value(self):

        with self.assertRaises(ValueError):
            Cell(9, 0, 0, is_initial=True)
        with self.assertRaises(ValueError):
            Cell(9, 0, 0, poss_vals=frozenset(), is_initial=True)

        c = Cell(9, 0, 0, 1, is_initial=True)
        self.assertTrue(c.is_initial())

        c = Cell(9, 0, 0, 1)
        self.assertFalse(c.is_initial())
Beispiel #2
0
def _clear_possible_action(board: Board, mod_cell: Cell, value: int):
    if mod_cell.is_initial():
        return

    if mod_cell.value() is not None:
        return

    if mod_cell.has_possible_val(value):
        new_cell = mod_cell.clear_possible_value(value)
        board.set_cell(new_cell)