diff --git a/.gitignore b/.gitignore index bee8a64..6e17127 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ __pycache__ +*.txt +*.md diff --git a/d16.py b/d16.py new file mode 100644 index 0000000..61e8a65 --- /dev/null +++ b/d16.py @@ -0,0 +1,37 @@ +import lib + +EXAMPLE = """ +""" + +def solve(lines: list[str]): + res = 0 + for (i, line) in enumerate(lines): + print(i, line) + # digits = lib.str_to_int_list(line) + # digit = lib.str_to_single_int(line) + return res + +def solve2(lines: list[str]): + res = 0 + for (i, line) in enumerate(lines): + print(i, line) + return res + +def main(): + lines = lib.str_to_lines_no_empty(EXAMPLE) + print("Example 1:", solve(lines)) + return + + lines = lib.str_to_lines_no_empty(open("ix.txt").read()) + print("Solution 1:", solve(lines)) + return + + lines = lib.str_to_lines_no_empty(EXAMPLE) + print("Example 2:", solve2(lines)) + return + + lines = lib.str_to_lines_no_empty(open("ix.txt").read()) + print("Solution 2:", solve2(lines)) + +if __name__ == "__main__": + main() diff --git a/get.sh b/get.sh new file mode 100755 index 0000000..0fc48a8 --- /dev/null +++ b/get.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi +DAY=$1 + +SESSION_COOKIE=$(keyring get aoc-session-cookie felixm) +echo $SESSION_COOKIE + +curl "https://adventofcode.com/2022/day/$DAY/input" --cookie "session=$SESSION_COOKIE" > "i$DAY.txt" + +# Get instructions as markdown file. +# curl "https://adventofcode.com/2022/day/$DAY" --cookie "session=$SESSION_COOKIE" > "day$DAY.html" +# pandoc -f html -t markdown "day$DAY.html" -o "d$DAY.md" +# rm "day$DAY.html"