Ejemplo n.º 1
0
 def test_example_with_cal_penalty(self):
     props = [[-1, -2, 6, 3], [2, 3, -2, -1]]
     cals = [8, 3]
     solution = Day15.solve_for_x_with_cal_penalty(props, cals, 500)
     self.assertEqual([40, 60], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(57600000, score)
Ejemplo n.º 2
0
 def test_example_with_cal_penalty(self):
     props = [[-1, -2, 6, 3], [2, 3, -2, -1]]
     cals = [8, 3]
     solution = Day15.solve_for_x_with_cal_penalty(props, cals, 500)
     self.assertEqual([40, 60], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(57600000, score)
Ejemplo n.º 3
0
 def test_solution_with_cals(self):
     props = [[2,0,-2,0],[0,5,-3,0],[0,0,5,-1],[0,-1,0,5]]
     cals = [3, 3, 8, 8]
     solution = Day15.solve_for_x_with_cal_penalty(props, cals, 500)
     self.assertEqual([46, 14, 30, 10], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(1766400, score)
     cal_score = Day15.calories_for_x(solution, cals)
     self.assertEqual(500, cal_score)
Ejemplo n.º 4
0
 def test_solution_with_cals(self):
     props = [[2, 0, -2, 0], [0, 5, -3, 0], [0, 0, 5, -1], [0, -1, 0, 5]]
     cals = [3, 3, 8, 8]
     solution = Day15.solve_for_x_with_cal_penalty(props, cals, 500)
     self.assertEqual([46, 14, 30, 10], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(1766400, score)
     cal_score = Day15.calories_for_x(solution, cals)
     self.assertEqual(500, cal_score)
def main():
    Day0.run()
    Day1.run()
    Day2.run()
    Day3.run()
    Day4.run()
    Day5.run()
    Day6.run()
    Day7.run()
    Day8.run()
    Day9.run()
    Day10.run()
    Day11.run()
    Day12.run()
    Day13.run()
    Day14.run()
    Day15.run()
    Day16.run()
    Day17.run()
    Day18.run()
    Day19.run()
Ejemplo n.º 6
0
 def test_example(self):
     props = [[-1, -2, 6, 3], [2, 3, -2, -1]]
     solution = Day15.solve_for_x_from_props(props)
     self.assertEqual([44, 56], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(62842880, score)
Ejemplo n.º 7
0
 def test_solution_without_cals(self):
     props = [[2,0,-2,0],[0,5,-3,0],[0,0,5,-1],[0,-1,0,5]]
     solution = Day15.solve_for_x_from_props(props)
     self.assertEqual([17, 19, 38, 26], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(21367368, score)
Ejemplo n.º 8
0
 def test_calories_for_x_with_example(self):
     self.assertEqual(500, Day15.calories_for_x([40, 60], [8, 3]))
Ejemplo n.º 9
0
 def test_example(self):
     props = [[-1, -2, 6, 3], [2, 3, -2, -1]]
     solution = Day15.solve_for_x_from_props(props)
     self.assertEqual([44, 56], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(62842880, score)
Ejemplo n.º 10
0
 def test_solution_without_cals(self):
     props = [[2, 0, -2, 0], [0, 5, -3, 0], [0, 0, 5, -1], [0, -1, 0, 5]]
     solution = Day15.solve_for_x_from_props(props)
     self.assertEqual([17, 19, 38, 26], solution)
     score = Day15.evaluate_x_with_props(solution, props)
     self.assertEqual(21367368, score)
Ejemplo n.º 11
0
 def test_calories_for_x_with_example(self):
     self.assertEqual(500, Day15.calories_for_x([40, 60], [8, 3]))