Exemplo n.º 1
0
def part_one():
    with open("data/03_input.txt", "r") as f:
        wire = f.readlines()
    wire1 = utils.list_from_string(wire[0])
    wire2 = utils.list_from_string(wire[1])
    distance = manhattan_distance(wire1, wire2)
    print(f"Part One {distance}")
Exemplo n.º 2
0
def test_part_two_case_two():
    wire1 = utils.list_from_string("R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51")
    wire2 = utils.list_from_string("U98,R91,D20,R16,D67,R40,U7,R15,U6,R7")
    assert closest_intersection(wire1, wire2) == 410
Exemplo n.º 3
0
def test_part_two_case_one():
    wire1 = utils.list_from_string("R75,D30,R83,U83,L12,D49,R71,U7,L72")
    wire2 = utils.list_from_string("U62,R66,U55,R34,D71,R55,D58,R83")
    assert closest_intersection(wire1, wire2) == 610
Exemplo n.º 4
0
def test_part_one_case_two():
    wire1 = utils.list_from_string("R98,U47,R26,D63,R33,U87,L62,D20,R33,U53,R51")
    wire2 = utils.list_from_string("U98,R91,D20,R16,D67,R40,U7,R15,U6,R7")
    assert manhattan_distance(wire1, wire2) == 135
Exemplo n.º 5
0
def test_part_one_case_one():
    wire1 = utils.list_from_string("R75,D30,R83,U83,L12,D49,R71,U7,L72")
    wire2 = utils.list_from_string("U62,R66,U55,R34,D71,R55,D58,R83")
    assert manhattan_distance(wire1, wire2) == 159