Exemple #1
0
 def test_part2b(self):
     chall = Wires()
     chall = Wires()
     chall.load([
         "R75,D30,R83,U83,L12,D49,R71,U7,L72",
         "U62,R66,U55,R34,D71,R55,D58,R83"
     ])
     self.assertEqual(chall.min_length(), 610)
Exemple #2
0
 def test_part2c(self):
     chall = Wires()
     chall = Wires()
     chall.load([
         "R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51",
         "U98,R91,D20,R16,D67,R40,U7,R15,U6,R7"
     ])
     self.assertEqual(chall.min_length(), 410)
Exemple #3
0
def main():
    chall = Wires()
    with open('data/3') as fh:
        lines = fh.readlines()
        chall.load(lines)
    print(f"Part 1: {chall.min_length_manhattan()}")
    print(f"Part 2: {chall.min_length()}")
Exemple #4
0
 def test_demo(self):
     chall = Wires()
     chall.load(["R8,U5,L5,D3", "U7,R6,D4,L4"])
     self.assertEqual(chall.min_length_manhattan(), 6)
Exemple #5
0
 def test_part2a(self):
     chall = Wires()
     chall = Wires()
     chall.load(["R8,U5,L5,D3", "U7,R6,D4,L4"])
     self.assertEqual(chall.min_length(), 30)