def test_improved_compression(self): two = Solver(from_str="(3x3)XYZ").solve_part_two() self.assertEqual(two, 9) two = Solver(from_str="X(8x2)(3x3)ABCY").solve_part_two() self.assertEqual(two, 20) two = Solver( from_str="(27x12)(20x12)(13x14)(7x10)(1x12)A").solve_part_two() self.assertEqual(two, 241920) two = Solver( from_str="(25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN" ).solve_part_two() self.assertEqual(two, 445)
def test_compression(self): one = Solver(from_str="ADVENT").solve_part_one() self.assertEqual(one, 6) one = Solver(from_str="A(1x5)BC").solve_part_one() self.assertEqual(one, 7) one = Solver(from_str="(3x3)XYZ").solve_part_one() self.assertEqual(one, 9) one = Solver(from_str="A(2x2)BCD(2x2)EFG").solve_part_one() self.assertEqual(one, 11) one = Solver(from_str="(6x1)(1x3)A").solve_part_one() self.assertEqual(one, 6) one = Solver(from_str="X(8x2)(3x3)ABCY").solve_part_one() self.assertEqual(one, 18)
def test_examples_one(self): example_input = "9 players; last marble is worth 25 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 32) example_input = "10 players; last marble is worth 1618 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 8317) example_input = "13 players; last marble is worth 7999 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 146373) example_input = "17 players; last marble is worth 1104 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 2764) example_input = "21 players; last marble is worth 6111 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 54718) example_input = "30 players; last marble is worth 5807 points" one = Solver(from_str=example_input).solve_part_one() self.assertEqual(one, 37305)
def test_solution(self): (one, two) = Solver(from_file="input/december09.input").solve() self.assertEqual(one, 152851) self.assertEqual(two, 11797310782)
def test_solution(self): s = Solver(from_file="input/december09.input") one = s.solve_part_one() self.assertEqual(one, 436720)
def test_examples(self): s = Solver(from_file='input/dec09-sample.in') (one, two) = s.solve() self.assertEqual(one, 605) self.assertEqual(two, 982)
def test_solution(self): s = Solver(from_file='input/dec09.in') (one, two) = s.solve() self.assertEqual(one, 251) self.assertEqual(two, 898)