day 4, add sample file

This commit is contained in:
setop 2022-02-21 23:35:01 +01:00
parent 6435f86126
commit 46015a25bc
2 changed files with 30 additions and 47 deletions

View File

@ -10,36 +10,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 65,
"id": "f81b055e", "id": "97f08c2f",
"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",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -48,7 +20,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 66,
"id": "e8a71b8a", "id": "e8a71b8a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -58,7 +30,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 67,
"id": "fd29a42b", "id": "fd29a42b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -68,7 +40,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 68,
"id": "1a0fb4f1", "id": "1a0fb4f1",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -92,7 +64,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 69,
"id": "a460886c", "id": "a460886c",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -131,7 +103,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 70,
"id": "e18c276b", "id": "e18c276b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -141,7 +113,7 @@
"74320" "74320"
] ]
}, },
"execution_count": 27, "execution_count": 70,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -167,7 +139,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 71,
"id": "61f6c035", "id": "61f6c035",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
@ -177,7 +149,7 @@
"17884" "17884"
] ]
}, },
"execution_count": 28, "execution_count": 71,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -190,18 +162,10 @@
" loosing_grids = list(filter(lambda g: not wining_grid(g), grids))\n", " loosing_grids = list(filter(lambda g: not wining_grid(g), grids))\n",
" if len(loosing_grids) == 1:\n", " if len(loosing_grids) == 1:\n",
" lg = loosing_grids[0]\n", " lg = loosing_grids[0]\n",
" return run_1([lg], numbers[i+1:])\n", " return run_1([lg], numbers[i:])\n",
"\n", "\n",
"run_2(grids, numbers)" "run_2(grids, numbers)"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"id": "128cac38",
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

19
d04/sample Normal file
View File

@ -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