Пример #1
0
 def __init__(self, y, x, possibilities=None, val=None):
     self.y = y
     self.x = x
     self.block = SudokuHelper.loc_to_block_num(y, x)
     self.block_cell_num = SudokuHelper.loc_to_block_cell_num(y, x)
     self.possibilities = copy.deepcopy(possibilities if possibilities is not None else all_possibilities)
     self.name = 'c' + str(self.y) + str(self.x) + str(self.block)
     self.val = val
Пример #2
0
 def __init__(self, y, x, possibilities=None, val=None):
     self.y = y
     self.x = x
     self.block = SudokuHelper.loc_to_block_num(y, x)
     self.block_cell_num = SudokuHelper.loc_to_block_cell_num(y, x)
     self.possibilities = copy.deepcopy(
         possibilities if possibilities is not None else all_possibilities)
     self.name = 'c' + str(self.y) + str(self.x) + str(self.block)
     self.val = val
Пример #3
0
 def test_loc_to_block_num(self):
     self.assertEqual(SudokuHelper.loc_to_block_num(0, 0), 0)
     self.assertEqual(SudokuHelper.loc_to_block_num(2, 2), 0)
     self.assertEqual(SudokuHelper.loc_to_block_num(3, 2), 3)
     self.assertEqual(SudokuHelper.loc_to_block_num(4, 7), 5)
     self.assertEqual(SudokuHelper.loc_to_block_num(6, 6), 8)
     self.assertEqual(SudokuHelper.loc_to_block_num(8, 8), 8)
Пример #4
0
 def test_loc_to_block_num(self):
     self.assertEqual(SudokuHelper.loc_to_block_num(0, 0), 0)
     self.assertEqual(SudokuHelper.loc_to_block_num(2, 2), 0)
     self.assertEqual(SudokuHelper.loc_to_block_num(3, 2), 3)
     self.assertEqual(SudokuHelper.loc_to_block_num(4, 7), 5)
     self.assertEqual(SudokuHelper.loc_to_block_num(6, 6), 8)
     self.assertEqual(SudokuHelper.loc_to_block_num(8, 8), 8)