From 46015a25bcf237c4605e8beef221ce8cf798f36d Mon Sep 17 00:00:00 2001 From: setop Date: Mon, 21 Feb 2022 23:35:01 +0100 Subject: [PATCH] day 4, add sample file --- d04/d04.ipynb | 58 ++++++++++----------------------------------------- d04/sample | 19 +++++++++++++++++ 2 files changed, 30 insertions(+), 47 deletions(-) create mode 100644 d04/sample diff --git a/d04/d04.ipynb b/d04/d04.ipynb index aac8dc4..4c0e4c5 100644 --- a/d04/d04.ipynb +++ b/d04/d04.ipynb @@ -10,36 +10,8 @@ }, { "cell_type": "code", - "execution_count": 21, - "id": "f81b055e", - "metadata": {}, - "outputs": [], - "source": [ - "sample = \"\"\"7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1\n", - "\n", - "22 13 17 11 0\n", - " 8 2 23 4 24\n", - "21 9 14 16 7\n", - " 6 10 3 18 5\n", - " 1 12 20 15 19\n", - "\n", - " 3 15 0 2 22\n", - " 9 18 13 17 5\n", - "19 8 7 25 23\n", - "20 11 10 24 4\n", - "14 21 16 12 6\n", - "\n", - "14 21 17 24 4\n", - "10 16 15 9 19\n", - "18 8 23 26 20\n", - "22 11 13 6 5\n", - " 2 0 12 3 7\"\"\"" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "9bda4c17", + "execution_count": 65, + "id": "97f08c2f", "metadata": {}, "outputs": [], "source": [ @@ -48,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 66, "id": "e8a71b8a", "metadata": {}, "outputs": [], @@ -58,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 67, "id": "fd29a42b", "metadata": {}, "outputs": [], @@ -68,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 68, "id": "1a0fb4f1", "metadata": {}, "outputs": [], @@ -92,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 69, "id": "a460886c", "metadata": {}, "outputs": [], @@ -131,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 70, "id": "e18c276b", "metadata": {}, "outputs": [ @@ -141,7 +113,7 @@ "74320" ] }, - "execution_count": 27, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } @@ -167,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 71, "id": "61f6c035", "metadata": {}, "outputs": [ @@ -177,7 +149,7 @@ "17884" ] }, - "execution_count": 28, + "execution_count": 71, "metadata": {}, "output_type": "execute_result" } @@ -190,18 +162,10 @@ " loosing_grids = list(filter(lambda g: not wining_grid(g), grids))\n", " if len(loosing_grids) == 1:\n", " lg = loosing_grids[0]\n", - " return run_1([lg], numbers[i+1:])\n", + " return run_1([lg], numbers[i:])\n", "\n", "run_2(grids, numbers)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "128cac38", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/d04/sample b/d04/sample new file mode 100644 index 0000000..669a51d --- /dev/null +++ b/d04/sample @@ -0,0 +1,19 @@ +7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 + +22 13 17 11 0 + 8 2 23 4 24 +21 9 14 16 7 + 6 10 3 18 5 + 1 12 20 15 19 + + 3 15 0 2 22 + 9 18 13 17 5 +19 8 7 25 23 +20 11 10 24 4 +14 21 16 12 6 + +14 21 17 24 4 +10 16 15 9 19 +18 8 23 26 20 +22 11 13 6 5 + 2 0 12 3 7