From 56deb7fde11a542a481737bb9bc5a69b614b46bd Mon Sep 17 00:00:00 2001 From: Dazbo Date: Sat, 21 Dec 2024 08:18:56 +0000 Subject: [PATCH] Started --- .../Dazbo's_Advent_of_Code_2024.ipynb | 418 +++++++++++++++++- src/AoC_2024/d21/input/input.txt | Bin 0 -> 47 bytes 2 files changed, 411 insertions(+), 7 deletions(-) create mode 100644 src/AoC_2024/d21/input/input.txt diff --git a/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb b/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb index 3a81dfe..d16d397 100644 --- a/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb +++ b/src/AoC_2024/Dazbo's_Advent_of_Code_2024.ipynb @@ -48,12 +48,131 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "id": "9Dgeww1rMrkQ", "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: jupyterlab-lsp in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (5.1.0)\n", + "Requirement already satisfied: ipykernel in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (6.29.5)\n", + "Requirement already satisfied: ipywidgets in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (8.1.5)\n", + "Requirement already satisfied: matplotlib in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (3.10.0)\n", + "Requirement already satisfied: pandas in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (2.2.3)\n", + "Requirement already satisfied: networkx in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (3.4.2)\n", + "Requirement already satisfied: sympy in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (1.13.3)\n", + "Requirement already satisfied: dazbo-commons in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (0.1.5)\n", + "Requirement already satisfied: colorama in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (0.4.6)\n", + "Requirement already satisfied: python-dotenv in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (1.0.1)\n", + "Requirement already satisfied: tqdm in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (4.67.1)\n", + "Requirement already satisfied: jupyter-lsp>=2.0.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-lsp) (2.2.5)\n", + "Requirement already satisfied: jupyterlab<5.0.0a0,>=4.1.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-lsp) (4.3.0)\n", + "Requirement already satisfied: comm>=0.1.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (0.2.2)\n", + "Requirement already satisfied: debugpy>=1.6.5 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (1.8.8)\n", + "Requirement already satisfied: ipython>=7.23.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (8.29.0)\n", + "Requirement already satisfied: jupyter-client>=6.1.12 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (8.6.3)\n", + "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (5.7.2)\n", + "Requirement already satisfied: matplotlib-inline>=0.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (0.1.7)\n", + "Requirement already satisfied: nest-asyncio in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (1.6.0)\n", + "Requirement already satisfied: packaging in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (24.1)\n", + "Requirement already satisfied: psutil in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (6.1.0)\n", + "Requirement already satisfied: pyzmq>=24 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (26.2.0)\n", + "Requirement already satisfied: tornado>=6.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (6.4.1)\n", + "Requirement already satisfied: traitlets>=5.4.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipykernel) (5.14.3)\n", + "Requirement already satisfied: widgetsnbextension~=4.0.12 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipywidgets) (4.0.13)\n", + "Requirement already satisfied: jupyterlab-widgets~=3.0.12 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipywidgets) (3.0.13)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (1.3.1)\n", + "Requirement already satisfied: cycler>=0.10 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (4.54.1)\n", + "Requirement already satisfied: kiwisolver>=1.3.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (1.4.7)\n", + "Requirement already satisfied: numpy>=1.23 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (2.1.3)\n", + "Requirement already satisfied: pillow>=8 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (11.0.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (3.2.0)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from matplotlib) (2.9.0)\n", + "Requirement already satisfied: pytz>=2020.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from pandas) (2024.2)\n", + "Requirement already satisfied: tzdata>=2022.7 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from pandas) (2024.2)\n", + "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from sympy) (1.3.0)\n", + "Requirement already satisfied: decorator in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (5.1.1)\n", + "Requirement already satisfied: jedi>=0.16 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (0.19.2)\n", + "Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (3.0.48)\n", + "Requirement already satisfied: pygments>=2.4.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (2.18.0)\n", + "Requirement already satisfied: stack-data in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (0.6.2)\n", + "Requirement already satisfied: pexpect>4.3 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from ipython>=7.23.1->ipykernel) (4.9.0)\n", + "Requirement already satisfied: platformdirs>=2.5 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.3.6)\n", + "Requirement already satisfied: jupyter-server>=1.1.2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.14.2)\n", + "Requirement already satisfied: async-lru>=1.0.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2.0.4)\n", + "Requirement already satisfied: httpx>=0.25.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.27.2)\n", + "Requirement already satisfied: jinja2>=3.0.3 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (3.1.4)\n", + "Requirement already satisfied: jupyterlab-server<3,>=2.27.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2.27.3)\n", + "Requirement already satisfied: notebook-shim>=0.2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.2.4)\n", + "Requirement already satisfied: setuptools>=40.1.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (75.1.0)\n", + "Requirement already satisfied: six>=1.5 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)\n", + "Requirement already satisfied: anyio in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (4.6.2.post1)\n", + "Requirement already satisfied: certifi in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2024.8.30)\n", + "Requirement already satisfied: httpcore==1.* in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (1.0.6)\n", + "Requirement already satisfied: idna in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (3.10)\n", + "Requirement already satisfied: sniffio in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (1.3.1)\n", + "Requirement already satisfied: h11<0.15,>=0.13 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from httpcore==1.*->httpx>=0.25.0->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.14.0)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel) (0.8.4)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jinja2>=3.0.3->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (3.0.2)\n", + "Requirement already satisfied: argon2-cffi>=21.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (23.1.0)\n", + "Requirement already satisfied: jupyter-events>=0.9.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.10.0)\n", + "Requirement already satisfied: jupyter-server-terminals>=0.4.4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.5.3)\n", + "Requirement already satisfied: nbconvert>=6.4.4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (7.16.4)\n", + "Requirement already satisfied: nbformat>=5.3.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (5.10.4)\n", + "Requirement already satisfied: overrides>=5.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (7.7.0)\n", + "Requirement already satisfied: prometheus-client>=0.9 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.21.0)\n", + "Requirement already satisfied: send2trash>=1.8.2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.8.3)\n", + "Requirement already satisfied: terminado>=0.8.3 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.18.1)\n", + "Requirement already satisfied: websocket-client>=1.7 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.8.0)\n", + "Requirement already satisfied: babel>=2.10 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2.16.0)\n", + "Requirement already satisfied: json5>=0.9.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.9.28)\n", + "Requirement already satisfied: jsonschema>=4.18.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (4.23.0)\n", + "Requirement already satisfied: requests>=2.31 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2.32.3)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from pexpect>4.3->ipython>=7.23.1->ipykernel) (0.7.0)\n", + "Requirement already satisfied: wcwidth in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython>=7.23.1->ipykernel) (0.2.13)\n", + "Requirement already satisfied: executing>=1.2.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.1.0)\n", + "Requirement already satisfied: asttokens>=2.1.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.4.1)\n", + "Requirement already satisfied: pure-eval in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.2.3)\n", + "Requirement already satisfied: argon2-cffi-bindings in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from argon2-cffi>=21.1->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (21.2.0)\n", + "Requirement already satisfied: attrs>=22.2.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (24.2.0)\n", + "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2024.10.1)\n", + "Requirement already satisfied: referencing>=0.28.4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.35.1)\n", + "Requirement already satisfied: rpds-py>=0.7.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (0.21.0)\n", + "Requirement already satisfied: python-json-logger>=2.0.4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.0.7)\n", + "Requirement already satisfied: pyyaml>=5.3 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (6.0.2)\n", + "Requirement already satisfied: rfc3339-validator in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.1.4)\n", + "Requirement already satisfied: rfc3986-validator>=0.1.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.1.1)\n", + "Requirement already satisfied: beautifulsoup4 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (4.12.3)\n", + "Requirement already satisfied: bleach!=5.0.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (6.2.0)\n", + "Requirement already satisfied: defusedxml in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.7.1)\n", + "Requirement already satisfied: jupyterlab-pygments in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.3.0)\n", + "Requirement already satisfied: mistune<4,>=2.0.3 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (3.0.2)\n", + "Requirement already satisfied: nbclient>=0.5.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.10.0)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.5.1)\n", + "Requirement already satisfied: tinycss2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.4.0)\n", + "Requirement already satisfied: fastjsonschema>=2.15 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from nbformat>=5.3.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.20.0)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (3.4.0)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.27.1->jupyterlab<5.0.0a0,>=4.1.0->jupyterlab-lsp) (2.2.3)\n", + "Requirement already satisfied: webencodings in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.5.1)\n", + "Requirement already satisfied: fqdn in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.5.1)\n", + "Requirement already satisfied: isoduration in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (20.11.0)\n", + "Requirement already satisfied: jsonpointer>1.13 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (3.0.0)\n", + "Requirement already satisfied: uri-template in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.3.0)\n", + "Requirement already satisfied: webcolors>=24.6.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (24.11.1)\n", + "Requirement already satisfied: cffi>=1.0.1 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.17.1)\n", + "Requirement already satisfied: soupsieve>1.2 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from beautifulsoup4->nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.6)\n", + "Requirement already satisfied: pycparser in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi>=21.1->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.22)\n", + "Requirement already satisfied: arrow>=0.15.0 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.3.0)\n", + "Requirement already satisfied: types-python-dateutil>=2.8.10 in /home/darren/miniconda3/envs/.aoc-conda-env/lib/python3.13/site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.9.0.20241003)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "%pip install --upgrade --no-cache-dir \\\n", " jupyterlab-lsp ipykernel ipywidgets \\\n", @@ -124,12 +243,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "id": "SwzjfUFCKhXe", "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m07:51:51.174:aoc2024 - INF: Logger initialised.\u001b[39m\n", + "\u001b[34m07:51:51.175:aoc2024 - DBG: Debugging enabled\u001b[39m\n" + ] + } + ], "source": [ "# Setup logger\n", "YEAR = 2024\n", @@ -152,9 +280,32 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[34m07:51:51.183:aoc2024 - DBG: Checking if ffmpeg is installed\u001b[39m\n", + "\u001b[34m07:51:51.380:aoc2024 - DBG: ffmpeg version: ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers\n", + "built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)\n", + "configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared\n", + "libavutil 58. 29.100 / 58. 29.100\n", + "libavcodec 60. 31.102 / 60. 31.102\n", + "libavformat 60. 16.100 / 60. 16.100\n", + "libavdevice 60. 3.100 / 60. 3.100\n", + "libavfilter 9. 12.100 / 9. 12.100\n", + "libswscale 7. 5.100 / 7. 5.100\n", + "libswresample 4. 12.100 / 4. 12.100\n", + "libpostproc 57. 3.100 / 57. 3.100\u001b[39m\n", + "\u001b[34m07:51:51.380:aoc2024 - DBG: ffmpeg is already installed.\u001b[39m\n", + "\u001b[34m07:51:51.381:aoc2024 - DBG: Checking if dot is installed\u001b[39m\n", + "\u001b[34m07:51:51.390:aoc2024 - DBG: dot is not installed or absent from path.\u001b[39m\n", + "\u001b[32m07:51:51.390:aoc2024 - INF: Installing graphviz on Linux...\u001b[39m\n" + ] + } + ], "source": [ "import subprocess\n", "\n", @@ -7716,6 +7867,227 @@ "logger.info(f\"Part 2 soln={soln}\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "## Day 21: Keypad Conundrum" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "#### See [Day 21](https://adventofcode.com/2024/day/21)." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "DAY = \"21\" # replace with actual number (without leading digit)\n", + "show_day_link(DAY)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m07:54:02.245:aoc2024 - INF: Session cookie retrieved: 53616c...869b9b\u001b[39m\n", + "\u001b[34m07:54:02.753:aoc2024 - DBG: Writing input file input.txt\u001b[39m\n", + "\u001b[32m07:54:02.765:aoc2024 - INF: Input data:\n", + "1: 803A\n", + "2: 528A\n", + "3: 586A\n", + "4: 341A\n", + "5: 319A\u001b[39m\n" + ] + } + ], + "source": [ + "d_name = \"d\" + str(DAY).zfill(2) # e.g. d01\n", + "script_name = \"aoc\" + str(YEAR) + d_name # e.g. aoc2024d01\n", + "locations = dc.get_locations(d_name)\n", + "logger.setLevel(logging.DEBUG)\n", + "\n", + "# Retrieve input and store in local file\n", + "try:\n", + " write_puzzle_input_file(YEAR, DAY, locations)\n", + " with open(locations.input_file, mode=\"rt\") as f:\n", + " input_data = f.read().splitlines()\n", + "\n", + " logger.info(\"Input data:\\n%s\", dc.top_and_tail(input_data))\n", + "except ValueError as e:\n", + " logger.error(e)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day 21 Part 1\n", + "\n", + "We have a **numeric keypad** on a door that looks like this:\n", + "\n", + "```text\n", + "+---+---+---+\n", + "| 7 | 8 | 9 |\n", + "+---+---+---+\n", + "| 4 | 5 | 6 |\n", + "+---+---+---+\n", + "| 1 | 2 | 3 |\n", + "+---+---+---+\n", + " | 0 | A |\n", + " +---+---+\n", + "```\n", + "\n", + "And we have a robotic arm to manipulate, using a **robot directional remote** with buttons arranged like this:\n", + "\n", + "```text\n", + " +---+---+\n", + " | ^ | A |\n", + "+---+---+---+\n", + "| < | v | > |\n", + "+---+---+---+\n", + "```\n", + "\n", + "The robotic arm starts pointing at the `A`. The navigation buttons move the arm up/down/left/right, and the `A` causes the arm to push the button in front of it.\n", + "\n", + "So we could type `029A` like this: `^^AvvvA`.\n", + "\n", + "BUT, this robot remote is inaccessible, so we're using a **second robot directional remote** to control a second robotic arm. The second arm starts by pointing to the `A` of the first remote.\n", + "\n", + "So to perform `^^AvvvA` on the first remote, we would need to perform `v<>^AAvA<^AA>A^A` on the second remote.\n", + "\n", + "But this remote is also inaccessible to humans, so we need a **third robot directional remote**, which we will press ourselves. To achieve the sequence above we could tell it to do this:\n", + "`>^AvAA<^A>A>^AvA^A^A^A>AAvA^AA>^AAAvA<^A>A`.\n", + "\n", + "To summarise, there are the following keypads:\n", + "\n", + "- One directional keypad that you are using. (_diretional-remote 3_)\n", + "- Two directional keypads that robots are using. (_directional-remotes 1 and 2_)\n", + "- One numeric keypad (on a door) that a robot is using. (_numeric_)\n", + "\n", + "We're told that to unlock the door, we need to enter five codes. We're given an example:\n", + "\n", + "```text\n", + "029A\n", + "980A\n", + "179A\n", + "456A\n", + "379A\n", + "```\n", + "\n", + "We need to find the shortest sequence of button pushes necessary. E.g.\n", + "\n", + "```text\n", + "029A: >^AvAA<^A>A>^AvA^A^A^A>AAvA^AA>^AAAvA<^A>A\n", + "980A: >^AAAvA^A>^AvAA<^A>AA>^AAAvA<^A>A^AA\n", + "179A: >^A>^AAvAA<^A>A>^AAvA^A^AAAA>^AAAvA<^A>A\n", + "456A: >^AA>^AAvAA<^A>A^AA^AAA>^AAvA<^A>A\n", + "379A: >^AvA^A>^AAvA<^A>AAvA^A^AAAA>^AAAvA<^A>A\n", + "```\n", + "\n", + "The complexity of a single code (like 029A) is equal to the result of multiplying these two values:\n", + "\n", + "- The length of the shortest sequence of button presses you need to type on your directional keypad in order to cause the code to be typed on the numeric keypad; for 029A, this would be 68.\n", + "- The numeric part of the code (ignoring leading zeroes); for 029A, this would be 29.\n", + "\n", + "In the above example, complexity of the five codes can be found by calculating 68 * 29, 60 * 980, 68 * 179, 64 * 456, and 64 * 379. Adding these together produces `126384`.\n", + "\n", + "**What is the sum of the complexities of the five codes on your list?**\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "def solve_part1(data):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "sample_inputs = []\n", + "sample_inputs.append(\"\"\"abcdef\"\"\")\n", + "sample_answers = [\"uvwxyz\"]\n", + "\n", + "logger.setLevel(logging.DEBUG)\n", + "for curr_input, curr_ans in zip(sample_inputs, sample_answers):\n", + " validate(solve_part1(curr_input), curr_ans) # test with sample data\n", + " logger.info(\"Test passed\")\n", + "\n", + "logger.info(\"All tests passed!\")\n", + "\n", + "logger.setLevel(logging.INFO)\n", + "soln = solve_part1(input_data)\n", + "logger.info(f\"Part 1 soln={soln}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day 22 Part 2\n", + "\n", + "Overview..." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def solve_part2(data):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "sample_inputs = []\n", + "sample_inputs.append(\"\"\"abcdef\"\"\")\n", + "sample_answers = [\"uvwxyz\"]\n", + "\n", + "logger.setLevel(logging.DEBUG)\n", + "for curr_input, curr_ans in zip(sample_inputs, sample_answers):\n", + " validate(solve_part2(curr_input), curr_ans) # test with sample data\n", + " logger.info(\"Test passed\") \n", + "\n", + "logger.info(\"Tests passed!\")\n", + "\n", + "logger.setLevel(logging.INFO)\n", + "soln = solve_part2(input_data)\n", + "logger.info(f\"Part 2 soln={soln}\")" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -7724,6 +8096,38 @@ "## Day n: title" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "DAY = \"n\" # replace with actual number (without leading digit)\n", + "show_day_link(DAY)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "d_name = \"d\" + str(DAY).zfill(2) # e.g. d01\n", + "script_name = \"aoc\" + str(YEAR) + d_name # e.g. aoc2024d01\n", + "locations = dc.get_locations(d_name)\n", + "logger.setLevel(logging.DEBUG)\n", + "\n", + "# Retrieve input and store in local file\n", + "try:\n", + " write_puzzle_input_file(YEAR, DAY, locations)\n", + " with open(locations.input_file, mode=\"rt\") as f:\n", + " input_data = f.read().splitlines()\n", + "\n", + " logger.info(\"Input data:\\n%s\", dc.top_and_tail(input_data))\n", + "except ValueError as e:\n", + " logger.error(e)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/src/AoC_2024/d21/input/input.txt b/src/AoC_2024/d21/input/input.txt new file mode 100644 index 0000000000000000000000000000000000000000..a113140612c3f9a5414b8c1b467ee461cdb585bd GIT binary patch literal 47 zcmV+~0MP#cM@dveQdv+`0LFM=C*`j}camvp6{r{bljkmz%S62CWlXAj;Zi})>l>}1 F4q?+m6@>r* literal 0 HcmV?d00001