X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=src%2Fadvent11%2Fadvent11.ipynb;h=115e8ac128714d99d42921e92bb61d7510ff613c;hb=fc23edeb0e66a61d640dfeaffd5a274a63acf8c8;hp=6d40bf564a2aa6f5ce9f3f04381adbb20d764e88;hpb=c8dd17f67a0e6574e60eba88ca85adde5ad16b69;p=advent-of-code-17.git diff --git a/src/advent11/advent11.ipynb b/src/advent11/advent11.ipynb index 6d40bf5..115e8ac 100644 --- a/src/advent11/advent11.ipynb +++ b/src/advent11/advent11.ipynb @@ -12,21 +12,20 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "import Data.List.Split (splitOn)\n", - "import Data.List (mapAccumL)" + "import Data.List.Split (splitOn)" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ - "hexStep (Int, Int) -> String -> (Int, Int)\n", + "hexStep :: (Int, Int) -> String -> (Int, Int)\n", "hexStep (n, ne) s = case s of \n", " \"n\" -> (n + 1, ne)\n", " \"ne\" -> (n, ne + 1)\n", @@ -38,26 +37,7 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "(4,[1,3,5,7])" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "mapAccumL (\\a b -> (a + 1, a + b)) 0 [1,2,3,4]" - ] - }, - { - "cell_type": "code", - "execution_count": 23, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -66,83 +46,7 @@ }, { "cell_type": "code", - "execution_count": 24, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "distance $ hexPath $ splitOn \",\" \"ne,ne,ne\"" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "distance $ hexPath $ splitOn \",\" \"ne,ne,sw,sw\"" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "2" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "distance $ hexPath $ splitOn \",\" \"ne,ne,s,s\"" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "distance $ hexPath $ splitOn \",\" \"se,sw,se,sw,sw\"" - ] - }, - { - "cell_type": "code", - "execution_count": 28, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -265,7 +169,83 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "distance $ hexPath $ splitOn \",\" \"ne,ne,ne\"" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "distance $ hexPath $ splitOn \",\" \"ne,ne,sw,sw\"" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "distance $ hexPath $ splitOn \",\" \"ne,ne,s,s\"" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "distance $ hexPath $ splitOn \",\" \"se,sw,se,sw,sw\"" + ] + }, + { + "cell_type": "code", + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -274,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -288,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -307,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -316,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -335,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -354,7 +334,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -373,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -393,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -413,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -433,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -453,7 +433,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 21, "metadata": {}, "outputs": [], "source": [ @@ -462,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 22, "metadata": {}, "outputs": [], "source": [ @@ -476,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 23, "metadata": {}, "outputs": [ {