Exemple #1
0
def second():
    original = DataAnalyzer.int_csv("2019day2.txt")[0]
    target = 19690720
    done = False

    values = original.copy()
    opcoder(values, 79, 12)
    print(
        f"(2.2) Target {values[0]} matched with {79}, {12} to output of {100 * 79 + 12}"
    )

    exit(0)

    for i in range(0, 100):
        for j in range(0, 100):
            values = original.copy()
            opcoder(values, i, j)
            if values[0] == target:
                # 7912
                print("(2.2) Target matched with {:d}, {:d} to output of {:d}".
                      format(i, j, (100 * i + j)))
                done = True
                break

        if done:
            break

    if not done:
        print("Target not matched!!")
Exemple #2
0
def second():
    values = '0222112222120000'
    layers = imaging(values, 2, 2)
    decode(layers, 2, 2)

    values = DataAnalyzer.load("2019day8.txt")
    layers = imaging(values[0][:-1])
    decode(layers, 25, 6)
Exemple #3
0
def first():
    moons = [(-1, 0, 2), (2, -10, -7), (4, -8, 8), (3, 5, -1)]
    print("(test)", end="")
    steps(moons)

    values = DataAnalyzer.load("2019day12.txt")
    moons = positions(values)
    print("(12.1)", end="")
    steps(moons, 1000)
Exemple #4
0
def first():
    values = [
        'COM)B', 'B)C', 'C)D', 'D)E', 'E)F', 'B)G', 'G)H', 'D)I', 'E)J', 'J)K',
        'K)L'
    ]
    main = big_bang(values)
    orbits(main, True)

    values = DataAnalyzer.load("2019day6.txt")
    main = big_bang(values)
    orbits(main)
Exemple #5
0
def second():
    values = [
        'COM)B', 'B)C', 'C)D', 'D)E', 'E)F', 'B)G', 'G)H', 'D)I', 'E)J', 'J)K',
        'K)L', 'K)YOU', 'I)SAN'
    ]
    main = big_bang(values)
    locator(main, 'YOU', 'SAN', True)

    values = DataAnalyzer.load("2019day6.txt")
    main = big_bang(values)
    locator(main, 'YOU', 'SAN')
Exemple #6
0
def second():
    moons = [(-1, 0, 2), (2, -10, -7), (4, -8, 8), (3, 5, -1)]
    print("(test)", end="")
    steps(moons, -1)

    moons = [(-8, -10, 0), (5, 5, 10), (2, -7, 3), (9, -8, -3)]
    print("(test)", end="")
    steps(moons, -1)

    values = DataAnalyzer.load("2019day12.txt")
    moons = positions(values)
    print("(12.1)", end="")
    steps(moons, -1)
Exemple #7
0
def first():
    values = DataAnalyzer.load("2019day8.txt")
    layers = imaging(values[0][:-1])
    image, count = layer_with_fewest(layers, '0')
    print("At fewest 0's of {:d}, 1's * 2's is {:d}".format(count, (image.count('1') * image.count('2'))))
Exemple #8
0
def first():
    values = DataAnalyzer.int_csv("2019day2.txt")[0]
    opcoder(values, 12, 2)

    print("(2.1) Left position for gravity program: {:d}".format(values[0]))