year = info["year"] day = info["day"] title = info["title"] print(f"[yellow]AoC {year}[/yellow]: day {day} - {title}") print(f"Python {platform.python_version()}\n") try: challenge_input = open("input.txt").read() except FileNotFoundError: print("Error: could not open input.txt") sys.exit(-1) if "vis" in sys.argv: import visualise print("[green]Running visualisation....[/green]") visualise.visualise(challenge_input) sys.exit() run_tests(info["testCases"]) if "debug" in sys.argv: sys.exit() print("Answers") print("Part 1:", partOne(challenge_input)) print("Part 2:", partTwo(challenge_input))
day = info["day"] title = info["title"] print(f"[yellow]AoC {year}[/yellow]: day {day} - {title}") print(f"Python {platform.python_version()}\n") try: challenge_input = open("input.txt").read() except FileNotFoundError: print("Error: could not open input.txt") sys.exit(-1) if "vis" in sys.argv: import visualise print("[green]Running visualisation....[/green]") visualise.visualise(challenge_input) sys.exit() run_tests(info["testCases"]) if "debug" in sys.argv: sys.exit() print("Answers") print("Part 1: ", end="") print(partOne(challenge_input)) print("Part 2: ", end="") print(partTwo(challenge_input))
print("[green]Running visualisation....[/green]") visualise.visualise(challenge_input) sys.exit() if "ft" in sys.argv: force_time = True run_tests(info["testCases"]) if "debug" in sys.argv: sys.exit() print("Answers") print("Running part 1...", end="\r") output_string = "Part 1: " x, t = run_and_time(lambda: partOne(challenge_input)) output_string += str(x) if t > 15 or force_time: output_string += f" in {t} seconds" print(output_string + " " * 12) print("Running part 2...", end="\r") output_string = "Part 2: " x, t = run_and_time(lambda: partTwo(challenge_input)) output_string += str(x) if t > 15 or force_time: output_string += f" in {t} seconds" print(output_string + " " * 12)