From f45524e6ba9362216621c406f7025c383d44ebcb Mon Sep 17 00:00:00 2001 From: Dazbo Date: Fri, 1 Dec 2023 18:46:25 +0000 Subject: [PATCH] Better error from input get --- .../Dazbo's_Advent_of_Code_2023.ipynb | 602 +++++++++++++----- 1 file changed, 432 insertions(+), 170 deletions(-) diff --git a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb index b10a3450..11b91b0e 100644 --- a/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb +++ b/src/AoC_2023/Dazbo's_Advent_of_Code_2023.ipynb @@ -47,19 +47,118 @@ }, { "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 f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (5.0.0)\n", + "Requirement already satisfied: colorama in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (0.4.6)\n", + "Requirement already satisfied: python-dotenv in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (0.21.0)\n", + "Requirement already satisfied: ipykernel in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (6.25.0)\n", + "Requirement already satisfied: jupyter-lsp>=2.0.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-lsp) (2.2.0)\n", + "Requirement already satisfied: jupyterlab<5.0.0a0,>=4.0.6 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-lsp) (4.0.7)\n", + "Requirement already satisfied: comm>=0.1.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (0.1.2)\n", + "Requirement already satisfied: debugpy>=1.6.5 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (1.6.7)\n", + "Requirement already satisfied: ipython>=7.23.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (8.15.0)\n", + "Requirement already satisfied: jupyter-client>=6.1.12 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (7.4.9)\n", + "Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (5.3.0)\n", + "Requirement already satisfied: matplotlib-inline>=0.1 in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from ipykernel) (0.1.6)\n", + "Requirement already satisfied: nest-asyncio in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (1.5.6)\n", + "Requirement already satisfied: packaging in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (23.1)\n", + "Requirement already satisfied: psutil in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (5.9.0)\n", + "Requirement already satisfied: pyzmq>=20 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (25.1.1)\n", + "Requirement already satisfied: tornado>=6.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (6.3.3)\n", + "Requirement already satisfied: traitlets>=5.4.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipykernel) (5.7.1)\n", + "Requirement already satisfied: backcall in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from ipython>=7.23.1->ipykernel) (0.2.0)\n", + "Requirement already satisfied: decorator in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from ipython>=7.23.1->ipykernel) (5.1.1)\n", + "Requirement already satisfied: jedi>=0.16 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (0.18.1)\n", + "Requirement already satisfied: pickleshare in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from ipython>=7.23.1->ipykernel) (0.7.5)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (3.0.36)\n", + "Requirement already satisfied: pygments>=2.4.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (2.15.1)\n", + "Requirement already satisfied: stack-data in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from ipython>=7.23.1->ipykernel) (0.2.0)\n", + "Requirement already satisfied: entrypoints in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-client>=6.1.12->ipykernel) (0.4)\n", + "Requirement already satisfied: python-dateutil>=2.8.2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-client>=6.1.12->ipykernel) (2.8.2)\n", + "Requirement already satisfied: platformdirs>=2.5 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (3.10.0)\n", + "Requirement already satisfied: pywin32>=300 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (305.1)\n", + "Requirement already satisfied: jupyter-server>=1.1.2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.10.0)\n", + "Requirement already satisfied: async-lru>=1.0.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.0.4)\n", + "Requirement already satisfied: jinja2>=3.0.3 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (3.1.2)\n", + "Requirement already satisfied: jupyterlab-server<3,>=2.19.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.22.0)\n", + "Requirement already satisfied: notebook-shim>=0.2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (0.2.2)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.0 in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from jedi>=0.16->ipython>=7.23.1->ipykernel) (0.8.3)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jinja2>=3.0.3->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.1.1)\n", + "Requirement already satisfied: anyio>=3.1.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (3.5.0)\n", + "Requirement already satisfied: argon2-cffi in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (21.3.0)\n", + "Requirement already satisfied: jupyter-events>=0.6.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.6.3)\n", + "Requirement already satisfied: jupyter-server-terminals in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.4.4)\n", + "Requirement already satisfied: nbconvert>=6.4.4 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (6.5.4)\n", + "Requirement already satisfied: nbformat>=5.3.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (5.9.2)\n", + "Requirement already satisfied: overrides in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (7.4.0)\n", + "Requirement already satisfied: prometheus-client in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.14.1)\n", + "Requirement already satisfied: pywinpty in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.0.10)\n", + "Requirement already satisfied: send2trash>=1.8.2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.8.2)\n", + "Requirement already satisfied: terminado>=0.8.3 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.17.1)\n", + "Requirement already satisfied: websocket-client in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.58.0)\n", + "Requirement already satisfied: babel>=2.10 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.11.0)\n", + "Requirement already satisfied: json5>=0.9.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (0.9.6)\n", + "Requirement already satisfied: jsonschema>=4.17.3 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (4.17.3)\n", + "Requirement already satisfied: requests>=2.28 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.31.0)\n", + "Requirement already satisfied: wcwidth in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython>=7.23.1->ipykernel) (0.2.5)\n", + "Requirement already satisfied: six>=1.5 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from python-dateutil>=2.8.2->jupyter-client>=6.1.12->ipykernel) (1.16.0)\n", + "Requirement already satisfied: executing in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.8.3)\n", + "Requirement already satisfied: asttokens in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (2.0.5)\n", + "Requirement already satisfied: pure-eval in c:\\users\\djl\\appdata\\roaming\\python\\python311\\site-packages (from stack-data->ipython>=7.23.1->ipykernel) (0.2.2)\n", + "Requirement already satisfied: idna>=2.8 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from anyio>=3.1.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (3.4)\n", + "Requirement already satisfied: sniffio>=1.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from anyio>=3.1.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.2.0)\n", + "Requirement already satisfied: pytz>=2015.7 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from babel>=2.10->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2023.3.post1)\n", + "Requirement already satisfied: attrs>=17.4.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (23.1.0)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (0.18.0)\n", + "Requirement already satisfied: python-json-logger>=2.0.4 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.0.7)\n", + "Requirement already satisfied: pyyaml>=5.3 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (6.0)\n", + "Requirement already satisfied: rfc3339-validator in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-events>=0.6.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 f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.1.1)\n", + "Requirement already satisfied: lxml in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (4.9.3)\n", + "Requirement already satisfied: beautifulsoup4 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (4.12.2)\n", + "Requirement already satisfied: bleach in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (4.1.0)\n", + "Requirement already satisfied: defusedxml in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\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 f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.1.2)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.8.4)\n", + "Requirement already satisfied: nbclient>=0.5.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.5.13)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.5.0)\n", + "Requirement already satisfied: tinycss2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.2.1)\n", + "Requirement already satisfied: fastjsonschema in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from nbformat>=5.3.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.16.2)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from requests>=2.28->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2.0.4)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from requests>=2.28->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (1.26.16)\n", + "Requirement already satisfied: certifi>=2017.4.17 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from requests>=2.28->jupyterlab-server<3,>=2.19.0->jupyterlab<5.0.0a0,>=4.0.6->jupyterlab-lsp) (2023.7.22)\n", + "Requirement already satisfied: argon2-cffi-bindings in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from argon2-cffi->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (21.2.0)\n", + "Requirement already satisfied: fqdn in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.5.1)\n", + "Requirement already satisfied: isoduration in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (20.11.0)\n", + "Requirement already satisfied: jsonpointer>1.13 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.1)\n", + "Requirement already satisfied: uri-template in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.3.0)\n", + "Requirement already satisfied: webcolors>=1.11 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.13)\n", + "Requirement already satisfied: cffi>=1.0.1 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (1.15.1)\n", + "Requirement already satisfied: soupsieve>1.2 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from beautifulsoup4->nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.5)\n", + "Requirement already satisfied: webencodings in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from bleach->nbconvert>=6.4.4->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (0.5.1)\n", + "Requirement already satisfied: pycparser in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.21)\n", + "Requirement already satisfied: arrow>=0.15.0 in f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from isoduration->jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.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 f:\\users\\darren\\anaconda3\\envs\\ana-aoc\\lib\\site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=3.2.0->jupyter-events>=0.6.0->jupyter-server>=1.1.2->jupyter-lsp>=2.0.0->jupyterlab-lsp) (2.8.19.14)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + } + ], "source": [ "%pip install jupyterlab-lsp colorama python-dotenv ipykernel " ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "id": "p5Ki_HvOJUWk", "tags": [] @@ -109,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "id": "SwzjfUFCKhXe", "tags": [] @@ -205,7 +304,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -265,9 +364,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m18:21:18.733:__main__ - INF: Using .env at F:\\Users\\Darren\\localdev\\Python\\Advent-of-Code\\.env\u001b[39m\n" + ] + }, + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "def get_envs_from_file() -> bool:\n", " \"\"\" Look for .env files, read variables from it, and store as environment variables \"\"\"\n", @@ -289,12 +406,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "id": "kSem0cT_LApT", "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m18:21:18.743:__main__ - INF: Session cookie retrieved: 53616c...598658\u001b[39m\n" + ] + } + ], "source": [ "if os.getenv('AOC_SESSION_COOKIE'):\n", " logger.info('Session cookie retrieved: %s...%s', os.environ['AOC_SESSION_COOKIE'][0:6], os.environ['AOC_SESSION_COOKIE'][-6:])\n", @@ -329,7 +454,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "id": "VK27bcGiK0_M", "tags": [] @@ -378,7 +503,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": { "id": "lwP0r3BAaxjt", "tags": [] @@ -422,7 +547,9 @@ " file.write(data)\n", " return data\n", " else:\n", - " raise ValueError(f\"Unable to retrieve input data. HTTP response: {response.status_code}\")\n" + " raise ValueError(f\"Unable to retrieve input data.\\n\" +\n", + " f\"HTTP response: {response.status_code}\\n\" +\n", + " f\"{response.reason}: {response.content.decode('utf-8').strip()}\")\n" ] }, { @@ -438,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": { "id": "Y6nbd6WMryWi", "tags": [] @@ -466,7 +593,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": { "id": "A8sU4Ez_bBKl", "tags": [] @@ -642,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "id": "DT5FSYliC9wp", "tags": [] @@ -744,7 +871,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": { "id": "sbdA-geUNqAF", "tags": [] @@ -771,142 +898,6 @@ "To copy the template day, select all the cells in the `Day n` template, add a new cell at the end, and then paste the cells there." ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "xZvWwxmJbGbD" - }, - "source": [ - "## Day n: title" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "YGKQZAMNKA8M", - "tags": [] - }, - "outputs": [], - "source": [ - "DAY = \"n\" # replace with actual number (without leading digit)\n", - "logger.setLevel(logging.DEBUG)\n", - "day_link = f\"#### See [Day {DAY}](https://adventofcode.com/{YEAR}/day/{DAY}).\"\n", - "display(Markdown(day_link))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "8k00bAJR7vCX" - }, - "outputs": [], - "source": [ - "d_name = \"d\" + str(DAY).zfill(2) # e.g. d01\n", - "script_name = \"aoc\" + str(YEAR) + d_name # e.g. aoc2017d01\n", - "locations = get_locations(d_name)\n", - "\n", - "# SETUP LOGGING\n", - "logger.setLevel(logging.DEBUG)\n", - "# td.setup_file_logging(logger, locations.output_dir)\n", - "\n", - "# Retrieve input and store in local file\n", - "try:\n", - " write_puzzle_input_file(YEAR, DAY, locations)\n", - "except ValueError as e:\n", - " logger.error(e)\n", - "\n", - "with open(locations.input_file, mode=\"rt\") as f:\n", - " input_data = f.read().splitlines()\n", - "\n", - "logger.info(\"Input data:\\n%s\", top_and_tail(input_data))" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "W0tvEzJYxD6r" - }, - "source": [ - "### Day n Part 1\n", - "\n", - "Overview..." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "yq4_ffMZ75iq" - }, - "outputs": [], - "source": [ - "def solve_part1(data):\n", - " pass" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "QeazYTD0xS2C" - }, - "outputs": [], - "source": [ - "%%time\n", - "sample_inputs = [\"abcdef\"]\n", - "sample_answers = [\"uvwxyz\"]\n", - "\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", - "\n", - "soln = solve_part1(input_data)\n", - "logger.info(f\"Part 1 soln={soln}\")" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "bG210YZNxPO5" - }, - "source": [ - "### Day n Part 2\n", - "\n", - "Overview..." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "oGOtNVJ8xWHZ" - }, - "outputs": [], - "source": [ - "def solve_part2(data):\n", - " pass" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "id": "SuLYqDZX76u4" - }, - "outputs": [], - "source": [ - "%%time\n", - "sample_inputs = [\"abcdef\"]\n", - "sample_answers = [\"uvwxyz\"]\n", - "\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", - "\n", - "soln = solve_part2(input_data)\n", - "logger.info(f\"Part 2 soln={soln}\")" - ] - }, { "cell_type": "markdown", "metadata": { @@ -918,12 +909,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": { "id": "6VoMC3MaJ1I9", "tags": [] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/markdown": [ + "#### See [Day 1](https://adventofcode.com/2023/day/1)." + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "DAY = 1\n", "day_link = f\"#### See [Day {DAY}](https://adventofcode.com/{YEAR}/day/{DAY}).\"\n", @@ -932,21 +936,35 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "print(locations)" - ] - }, - { - "cell_type": "code", - "execution_count": null, + "execution_count": 21, "metadata": { "id": "aNvM0hOF0tBR", "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m18:27:56.107:aoc2023 - INF: Session cookie retrieved: 53616c...598658\u001b[39m\n", + "\u001b[31m18:27:56.683:aoc2023 - ERR: Unable to retrieve input data.\n", + "HTTP response: 400\n", + "Bad Request: Puzzle inputs differ by user. Please log in to get your puzzle input.\u001b[39m\n" + ] + }, + { + "ename": "FileNotFoundError", + "evalue": "[Errno 2] No such file or directory: 'F:\\\\Users\\\\Darren\\\\localdev\\\\Python\\\\Advent-of-Code\\\\src\\\\AoC_2023\\\\d01\\\\input\\\\input.txt'", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32mf:\\Users\\Darren\\localdev\\Python\\Advent-of-Code\\src\\AoC_2023\\Dazbo's_Advent_of_Code_2023.ipynb Cell 28\u001b[0m line \u001b[0;36m1\n\u001b[0;32m 12\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mValueError\u001b[39;00m \u001b[39mas\u001b[39;00m e:\n\u001b[0;32m 13\u001b[0m logger\u001b[39m.\u001b[39merror(e)\n\u001b[1;32m---> 15\u001b[0m \u001b[39mwith\u001b[39;00m \u001b[39mopen\u001b[39m(locations\u001b[39m.\u001b[39minput_file, mode\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mrt\u001b[39m\u001b[39m\"\u001b[39m) \u001b[39mas\u001b[39;00m f:\n\u001b[0;32m 16\u001b[0m input_data \u001b[39m=\u001b[39m f\u001b[39m.\u001b[39mread()\u001b[39m.\u001b[39msplitlines()\n\u001b[0;32m 18\u001b[0m logger\u001b[39m.\u001b[39minfo(\u001b[39m\"\u001b[39m\u001b[39mInput data:\u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m%s\u001b[39;00m\u001b[39m\"\u001b[39m, top_and_tail(input_data))\n", + "File \u001b[1;32mf:\\Users\\Darren\\anaconda3\\envs\\ana-aoc\\Lib\\site-packages\\IPython\\core\\interactiveshell.py:286\u001b[0m, in \u001b[0;36m_modified_open\u001b[1;34m(file, *args, **kwargs)\u001b[0m\n\u001b[0;32m 279\u001b[0m \u001b[39mif\u001b[39;00m file \u001b[39min\u001b[39;00m {\u001b[39m0\u001b[39m, \u001b[39m1\u001b[39m, \u001b[39m2\u001b[39m}:\n\u001b[0;32m 280\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[0;32m 281\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mIPython won\u001b[39m\u001b[39m'\u001b[39m\u001b[39mt let you open fd=\u001b[39m\u001b[39m{\u001b[39;00mfile\u001b[39m}\u001b[39;00m\u001b[39m by default \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 282\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mas it is likely to crash IPython. If you know what you are doing, \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 283\u001b[0m \u001b[39m\"\u001b[39m\u001b[39myou can use builtins\u001b[39m\u001b[39m'\u001b[39m\u001b[39m open.\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[0;32m 284\u001b[0m )\n\u001b[1;32m--> 286\u001b[0m \u001b[39mreturn\u001b[39;00m io_open(file, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n", + "\u001b[1;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'F:\\\\Users\\\\Darren\\\\localdev\\\\Python\\\\Advent-of-Code\\\\src\\\\AoC_2023\\\\d01\\\\input\\\\input.txt'" + ] + } + ], "source": [ "d_name = \"d\" + str(DAY).zfill(2) # e.g. d01\n", "script_name = \"aoc\" + str(YEAR) + d_name # e.g. aoc2017d01\n", @@ -992,7 +1010,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -1010,7 +1028,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": { "id": "rhWomZ6ewNi-", "tags": [] @@ -1058,12 +1076,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": { "id": "uw4xFe7R7jf0", "tags": [] }, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\u001b[32m18:09:29.992:aoc2023 - INF: Part 1 soln=55208\u001b[39m\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: total: 0 ns\n", + "Wall time: 2 ms\n" + ] + } + ], "source": [ "%%time\n", "sample_inputs = [[\"1abc2\", \"pqr3stu8vwx\", \"a1b2c3d4e5f\", \"treb7uchetabcdef\"]]\n", @@ -1125,12 +1159,240 @@ "logger.info(f\"Part 2 soln={soln}\")" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Day 2: title" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "DAY = \"2\" # replace with actual number (without leading digit)\n", + "logger.setLevel(logging.DEBUG)\n", + "day_link = f\"#### See [Day {DAY}](https://adventofcode.com/{YEAR}/day/{DAY}).\"\n", + "display(Markdown(day_link))" + ] + }, + { + "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. aoc2017d01\n", + "locations = get_locations(d_name)\n", + "\n", + "# SETUP LOGGING\n", + "logger.setLevel(logging.DEBUG)\n", + "# td.setup_file_logging(logger, locations.output_dir)\n", + "\n", + "# Retrieve input and store in local file\n", + "try:\n", + " write_puzzle_input_file(YEAR, DAY, locations)\n", + "except ValueError as e:\n", + " logger.error(e)\n", + "\n", + "with open(locations.input_file, mode=\"rt\") as f:\n", + " input_data = f.read().splitlines()\n", + "\n", + "logger.info(\"Input data:\\n%s\", top_and_tail(input_data))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day 2 Part 1\n", + "\n", + "Overview..." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def solve_part1(data):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "sample_inputs = [\"abcdef\"]\n", + "sample_answers = [\"uvwxyz\"]\n", + "\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", + "\n", + "soln = solve_part1(input_data)\n", + "logger.info(f\"Part 1 soln={soln}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day 2 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 = [\"abcdef\"]\n", + "sample_answers = [\"uvwxyz\"]\n", + "\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", + "\n", + "soln = solve_part2(input_data)\n", + "logger.info(f\"Part 2 soln={soln}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "---\n", + "## Day n: title" + ] + }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "DAY = \"n\" # replace with actual number (without leading digit)\n", + "logger.setLevel(logging.DEBUG)\n", + "day_link = f\"#### See [Day {DAY}](https://adventofcode.com/{YEAR}/day/{DAY}).\"\n", + "display(Markdown(day_link))" + ] + }, + { + "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. aoc2017d01\n", + "locations = get_locations(d_name)\n", + "\n", + "# SETUP LOGGING\n", + "logger.setLevel(logging.DEBUG)\n", + "# td.setup_file_logging(logger, locations.output_dir)\n", + "\n", + "# Retrieve input and store in local file\n", + "try:\n", + " write_puzzle_input_file(YEAR, DAY, locations)\n", + "except ValueError as e:\n", + " logger.error(e)\n", + "\n", + "with open(locations.input_file, mode=\"rt\") as f:\n", + " input_data = f.read().splitlines()\n", + "\n", + "logger.info(\"Input data:\\n%s\", top_and_tail(input_data))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day n Part 1\n", + "\n", + "Overview..." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def solve_part1(data):\n", + " pass" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%%time\n", + "sample_inputs = [\"abcdef\"]\n", + "sample_answers = [\"uvwxyz\"]\n", + "\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", + "\n", + "soln = solve_part1(input_data)\n", + "logger.info(f\"Part 1 soln={soln}\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Day n 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 = [\"abcdef\"]\n", + "sample_answers = [\"uvwxyz\"]\n", + "\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", + "\n", + "soln = solve_part2(input_data)\n", + "logger.info(f\"Part 2 soln={soln}\")" + ] } ], "metadata": {