Beispiel #1
0
def execute(prefix='.'):
    adventutil.setPrefix(prefix)

    # Part 1

    inst = adventutil.readProblem(delim='')
    x, y = [int(i) for i in adventutil.readProblem(2)]
    result = solve((inst, x, y))
    print(f"Part 1: {result}")

    # Part 2

    result = solve2((inst, x, y))
    result.show()
Beispiel #2
0
def execute(prefix='.'):
  adventutil.setPrefix(prefix)

  # Part 1

  inst = adventutil.readProblem(delim='-')
  result = solve(inst)
  print(f"Result: {result}")
Beispiel #3
0
def execute(prefix='.'):
    adventutil.setPrefix(prefix)

    # Part 1

    inst = adventutil.readProblem(as_int=False, delim='\n')
    result = solve(inst)
    print(f"Part 1: {result}")

    # Part 2

    result = solve2(inst)
    print(f"Part 2: {result}")
Beispiel #4
0
def execute(prefix='.'):
    adventutil.setPrefix(prefix)

    # Part 1

    inst = adventutil.readProblem()
    result = solve(inst)
    print(f"Part 1: {result}")

    # Part 2

    # inst = adventutil.readProblem('2')
    result = solve2(inst)
Beispiel #5
0
def execute(prefix='.'):
  adventutil.setPrefix(prefix)

  # Test

  test_tape = adventutil.readTest()
  test_result = intcode.oneTimeRun(test_tape)
  print(f"Test: {test_result}")

  # Part 1

  tape = adventutil.readProblem()
  result = intcode.oneTimeRun(tape)
  print(f"Part 1: {result}")

  # Part 2

  target = adventutil.readProblem('2')[0]
  for i in range(100):
    for j in range(100):
      if intcode.oneTimeRun(tape, noun=i, verb=j) == target:
        print(f"Part 2: {i} {j}")
        return
Beispiel #6
0
def execute(prefix='.'):
    adventutil.setPrefix(prefix)

    # Part 1

    tape = adventutil.readProblem()
    prep = intcode.PreparedIO([1])
    intcode.oneTimeRun(tape, prep=prep)
    print(f"Part 1: {prep.record}")

    # Part 2

    prep = intcode.PreparedIO([2])
    intcode.oneTimeRun(tape, prep=prep)
    print(f"Part 2: {prep.record}")
Beispiel #7
0
def execute(prefix='.'):
  adventutil.setPrefix(prefix)

  # Test

  test_inst = adventutil.readTest(as_int=False, delim='\n')
  result = solve(test_inst)
  print(f"Test: {result[0]}")

  # Part 1

  inst = adventutil.readProblem(as_int=False, delim='\n')
  result = solve(inst)
  print(f"Part 1: {result[0]}")

  # Part 2

  # inst = adventutil.readProblem('2')
  result2 = solve2(result)
  print(f"Part 2: {result2}")