示例#1
0
 def test_example(self):
     # 4
     # 3          LG
     # 2    HG
     # 1 E     HM    LM
     #      0  16  1 17
     test_data = [1 << 16 | 1 << 17, 1 << 0, 1 << 1, 0]
     s = Solver(from_str='...')
     self.assertEqual(s.explore(test_data), 11)
示例#2
0
 def test_part_one(self):
     # 4
     # 3                     XG XM RG RM
     # 2            PM    SM
     # 1 E TG TM PG    SG
     #      0 16  1 17  2 18  3 19  4 20
     part1_data = [
         1 << 0 | 1 << 1 | 1 << 2 | 1 << 16, 1 << 17 | 1 << 18,
         1 << 3 | 1 << 4 | 1 << 19 | 1 << 20, 0
     ]
     s = Solver(from_str='...')
     self.assertEqual(s.explore(part1_data), 31)
示例#3
0
 def test_part_two(self):
     # 4
     # 3                     XG XM RG RM
     # 2            PM    SM
     # 1 E TG TM PG    SG                EG EM DG DM
     #      0 16  1 17  2 18  3 19  4 20  5 21  6 22
     part2_data = [
         1 << 0 | 1 << 1 | 1 << 2 | 1 << 5 | 1 << 6 | 1 << 16 | 1 << 21
         | 1 << 22, 1 << 17 | 1 << 18, 1 << 3 | 1 << 4 | 1 << 19 | 1 << 20,
         0
     ]
     s = Solver(from_str='...')
     self.assertEqual(s.explore(part2_data), 55)