Ejemplo n.º 1
0
 def test_part_one(self):
     aunt_map = Day16.get_aunt_map_from_file("Day16.txt")
     aunt_candidate = {
         'children': 3,
         'cats': 7,
         'samoyeds': 2,
         'pomeranians': 3,
         'akitas': 0,
         'vizslas': 0,
         'goldfish': 5,
         'trees': 3,
         'cars': 2,
         'perfumes': 1
     }
     best_match = Day16.best_match_for_candidate(aunt_map, aunt_candidate)
     self.assertEqual(213, best_match)
Ejemplo n.º 2
0
	def test_part_one(self):
		aunt_map = Day16.get_aunt_map_from_file("Day16.txt")
		aunt_candidate = {
			'children': 3,
			'cats': 7,
			'samoyeds': 2,
			'pomeranians': 3,
			'akitas': 0,
			'vizslas': 0,
			'goldfish': 5,
			'trees': 3,
			'cars': 2,
			'perfumes': 1
		}
		best_match = Day16.best_match_for_candidate(aunt_map, aunt_candidate)
		self.assertEqual(213, best_match)
Ejemplo n.º 3
0
	def test_part_two(self):
		aunt_map = Day16.get_aunt_map_from_file("Day16.txt")
		aunt_candidate = {
			'children': 3,
			'cats': 7,
			'samoyeds': 2,
			'pomeranians': 3,
			'akitas': 0,
			'vizslas': 0,
			'goldfish': 5,
			'trees': 3,
			'cars': 2,
			'perfumes': 1
		}
		best_match = Day16.best_match_for_candidate(aunt_map, aunt_candidate, greater_keys=["cats", "trees"], lessthan_keys=["pomeranians", "goldfish"])
		self.assertEqual(323, best_match)
Ejemplo n.º 4
0
def parse_program(input_lines: list):
    pc_target = int(input_lines[0].split()[1])

    program_parts = []
    for line in input_lines[1:]:
        parts = line.split()
        program_parts.append(
            Day16.Instruction(parts[0], *list(map(int, parts[1:]))))

    return pc_target, program_parts
Ejemplo n.º 5
0
 def test_part_two(self):
     aunt_map = Day16.get_aunt_map_from_file("Day16.txt")
     aunt_candidate = {
         'children': 3,
         'cats': 7,
         'samoyeds': 2,
         'pomeranians': 3,
         'akitas': 0,
         'vizslas': 0,
         'goldfish': 5,
         'trees': 3,
         'cars': 2,
         'perfumes': 1
     }
     best_match = Day16.best_match_for_candidate(
         aunt_map,
         aunt_candidate,
         greater_keys=["cats", "trees"],
         lessthan_keys=["pomeranians", "goldfish"])
     self.assertEqual(323, best_match)
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()