[APL] Move solutions into apl files
This commit is contained in:
parent
eebb719bb1
commit
dbecbfef28
38 changed files with 125 additions and 1790 deletions
3
APL/2021/01.apl
Normal file
3
APL/2021/01.apl
Normal file
|
@ -0,0 +1,3 @@
|
|||
input ← ⍎¨⊃⎕NGET'../.cache/2021/1' 1
|
||||
⎕ ← +/2</ input
|
||||
⎕ ← +/2</3+/ input
|
|
@ -1,88 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "e9f1ae2e-3a25-44fb-ab6b-549e479d23d9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"nums ← ⍎¨⊃⎕NGET'01.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "7f29564e-fd80-449a-ad2e-0d026bd76f9a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "b08c0157-3259-44ca-a880-60b18618472a",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">1266\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/2</nums"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4304c252-699e-43de-8c8f-c2ecfc012151",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "b1b0af8a-3118-48a5-aeea-a8642982ec5c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">1217\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/2</3+/nums"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
3
APL/2021/02.apl
Normal file
3
APL/2021/02.apl
Normal file
|
@ -0,0 +1,3 @@
|
|||
input ← {a b←' '(≠⊆⊢)⍵⋄a (⍎b)} ¨ ⊃⎕NGET '../.cache/2021/2' 1
|
||||
⎕ ← ×/⊃{d h←⍵⋄(d+((2⊃⍺)×'d'≡⊃⊃⍺)-((2⊃⍺)×'u'≡⊃⊃⍺)) (h+((2⊃⍺)×'f'≡⊃⊃⍺))}/⌽(⊂(0 0)), input
|
||||
⎕ ← ×/1↓⊃{a h d←⍵⋄(a+((2⊃⍺)×'d'≡⊃⊃⍺)-((2⊃⍺)×'u'≡⊃⊃⍺)) (h+((2⊃⍺)×'f'≡⊃⊃⍺)) (d+((a×2⊃⍺)×'f'≡⊃⊃⍺))}/⌽(⊂(0 0 0)), input
|
|
@ -1,88 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "4573ce49-7e8e-4810-b463-8cfc867f215b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← {a b←' '(≠⊆⊢)⍵⋄a (⍎b)} ¨ ⊃⎕NGET '02.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1dc51bae-2fcf-4626-b974-18075c377913",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "b10e42b7-589e-41a8-a57b-fa9375ad2300",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">1648020\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"×/⊃{d h←⍵⋄(d+((2⊃⍺)×'d'≡⊃⊃⍺)-((2⊃⍺)×'u'≡⊃⊃⍺)) (h+((2⊃⍺)×'f'≡⊃⊃⍺))}/⌽(⊂(0 0)),data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2005d257-213a-4b78-82cc-86b9a8808191",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "1b08b311-2eb8-48ee-b0c5-d2e0e85ac66d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">1759818555\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"×/1↓⊃{a h d←⍵⋄(a+((2⊃⍺)×'d'≡⊃⊃⍺)-((2⊃⍺)×'u'≡⊃⊃⍺)) (h+((2⊃⍺)×'f'≡⊃⊃⍺)) (d+((a×2⊃⍺)×'f'≡⊃⊃⍺))}/⌽(⊂(0 0 0)),data"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
3
APL/2021/03.apl
Normal file
3
APL/2021/03.apl
Normal file
|
@ -0,0 +1,3 @@
|
|||
input ← ⊃⎕NGET '../.cache/2021/3' 1
|
||||
⎕ ← ×/⊃{⍺+2×⍵}/⌽(⊢,~)∘{(≢⍵)≤2×+/⍎¨⍵}¨↓⍉↑ input
|
||||
⎕ ← ×/{2⊥⍎¨⍵}¨{x←⍵⋄⊃⊃{i←⍺⋄m←{(x+1)⊃⍵,~⍵}{(≢⍵)≤2×+/⍎¨⍵}i⊃↓⍉↑⍵⋄o←({m=⍎i⊃⍵}¨⍵)/⍵⋄(1+0=≢o)⊃o ⍵}/⌽(⊂input),⍳≢⊃input}¨0 1
|
|
@ -1,88 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "99f6e7d7-c153-4f43-a953-e6f2e0a8fccd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⊃⎕NGET '03.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "f1a4ef9e-2a1a-429c-ba13-1f5041415d6d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "d4e3e1a9-00a2-42ce-8335-c462aa69a3dd",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">3895776\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"×/⊃{⍺+2×⍵}/⌽(⊢,~)∘{(≢⍵)≤2×+/⍎¨⍵}¨↓⍉↑data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2692e4a0-785e-4c39-b114-e8cf673daeab",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "06ccee11-257a-4e05-9313-a07e46b753cf",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">7928162\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"×/{2⊥⍎¨⍵}¨{x←⍵⋄⊃⊃{i←⍺⋄m←{(x+1)⊃⍵,~⍵}{(≢⍵)≤2×+/⍎¨⍵}i⊃↓⍉↑⍵⋄o←({m=⍎i⊃⍵}¨⍵)/⍵⋄(1+0=≢o)⊃o ⍵}/⌽(⊂data),⍳≢⊃data}¨0 1"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
5
APL/2021/04.apl
Normal file
5
APL/2021/04.apl
Normal file
|
@ -0,0 +1,5 @@
|
|||
input ← ⊃⎕NGET '../.cache/2021/4' 1
|
||||
nums ← ⍎¨','(≠⊆⊢)⊃input
|
||||
boards ← {{⍎¨' '(≠⊆⊢)⍵}¨¨({0≠≢⍵}¨⍵)⊆⍵}2↓input
|
||||
⎕ ← {i b←⍵⋄w←{({∨/(∧/¯1=⊢)¨⍵,↓⍉↑⍵}¨⍵)/⍵}b⋄0<≢w:((i-1)⊃nums)×+/(∊⊃w)~¯1⋄∇(1+i)({⍵=(i⊃nums):¯1⋄⍵}¨¨¨b)}1 boards
|
||||
⎕ ← {i b←⍵⋄w←{({∨/(∧/¯1=⊢)¨⍵,↓⍉↑⍵}¨⍵)/⍵}b⋄(0<≢w)∧1=≢b:((i-1)⊃nums)×+/(∊⊃w)~¯1⋄∇(1+i)({⍵=(i⊃nums):¯1⋄⍵}¨¨¨b~w)}1 boards
|
|
@ -1,90 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "a7062017-1cc1-4888-822f-236fc2cb4780",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⊃⎕NGET '04.txt' 1\n",
|
||||
"nums ← ⍎¨','(≠⊆⊢)⊃data\n",
|
||||
"boards ← {{⍎¨' '(≠⊆⊢)⍵}¨¨({0≠≢⍵}¨⍵)⊆⍵}2↓data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "bee465ae-0500-4fcd-8104-ed654a39f8f6",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "ad828024-cc75-459c-aeb5-eef32282c9f8",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">49860\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{i b←⍵⋄w←{({∨/(∧/¯1=⊢)¨⍵,↓⍉↑⍵}¨⍵)/⍵}b⋄0<≢w:((i-1)⊃nums)×+/(∊⊃w)~¯1⋄∇(1+i)({⍵=(i⊃nums):¯1⋄⍵}¨¨¨b)}1 boards"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a973e8ae-9fdb-4e38-b6f7-cb7d78a62c48",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "f66d1533-a6f6-4198-a2f0-e7f9cbf51257",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">24628\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{i b←⍵⋄w←{({∨/(∧/¯1=⊢)¨⍵,↓⍉↑⍵}¨⍵)/⍵}b⋄(0<≢w)∧1=≢b:((i-1)⊃nums)×+/(∊⊃w)~¯1⋄∇(1+i)({⍵=(i⊃nums):¯1⋄⍵}¨¨¨b~w)}1 boards"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
4
APL/2021/05.apl
Normal file
4
APL/2021/05.apl
Normal file
|
@ -0,0 +1,4 @@
|
|||
input ← ((⍎¨','(≠⊆⊢)⊢)¨(⊂'->')~⍨' '(≠⊆⊢)⊢)¨⊃⎕NGET '../.cache/2021/5' 1
|
||||
iter ← {a b←⍵⋄a≡b:⊂b⋄(⊂a),∇(a+×b-a) b}
|
||||
⎕ ← +/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨{(∨⌿⍉↑=⌿⍉↑⍵)/⍵} input
|
||||
⎕ ← +/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨ input
|
|
@ -1,98 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "a7062017-1cc1-4888-822f-236fc2cb4780",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ((⍎¨','(≠⊆⊢)⊢)¨(⊂'->')~⍨' '(≠⊆⊢)⊢)¨⊃⎕NGET '05.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "b23a78e7-12ef-4f68-b44e-666926097f07",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"iter ← {a b←⍵⋄a≡b:⊂b⋄(⊂a),∇(a+×b-a) b}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "bee465ae-0500-4fcd-8104-ed654a39f8f6",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "dd1b3c61-9480-4e03-b5a5-e116f50a7b6d",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">5698\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨{(∨⌿⍉↑=⌿⍉↑⍵)/⍵}data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a973e8ae-9fdb-4e38-b6f7-cb7d78a62c48",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "7691c6f8-f313-470d-971b-3a506053e6df",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">15463\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/2≤≢¨⊢/{⍺ ⍵}⌸⊃,/iter¨data"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
5
APL/2021/06.apl
Normal file
5
APL/2021/06.apl
Normal file
|
@ -0,0 +1,5 @@
|
|||
input ← ⍎¨','(≠⊆⊢)⊃⊃⎕NGET '../.cache/2021/6' 1
|
||||
⎕PP←32
|
||||
solve ← {+/({((⊃⍵+⊢)@7)1⌽⍵}⍣⍵) ⊢⌿⍉{⍺,1-⍨≢⍵}⌸input,⍨1-⍨⍳9}
|
||||
⎕ ← solve 80
|
||||
⎕ ← solve 256
|
|
@ -1,99 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "3e1eb3d0-7a65-403c-8816-0b914a1f705b",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⍎¨','(≠⊆⊢)⊃⊃⎕NGET '06.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "bac640c9-2cb2-4861-9fb9-2aba12138d3f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"⎕PP←32\n",
|
||||
"solve ← {+/({((⊃⍵+⊢)@7)1⌽⍵}⍣⍵) ⊢⌿⍉{⍺,1-⍨≢⍵}⌸data,⍨1-⍨⍳9}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "8213c71c-7fbb-41ba-9f01-ab7cf8da9bf5",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "fdb19c65-0147-4656-b698-8322bc292cbd",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">345793\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve 80"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "db5f241e-7218-4b8a-a881-cc265b619467",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "585dfd8f-1de6-4b6d-888c-579ea35ece24",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">1572643095893\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve 256"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
3
APL/2021/07.apl
Normal file
3
APL/2021/07.apl
Normal file
|
@ -0,0 +1,3 @@
|
|||
input ← ⍎¨','(≠⊆⊢)⊃⊃⎕NGET '../.cache/2021/7' 1
|
||||
⎕ ← ⌊/{+/|¨⍵-input}¨⍳≢input
|
||||
⎕ ← ⌊/{+/(+/⍳)¨|¨⍵-input}¨⍳≢input
|
|
@ -1,88 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⍎¨','(≠⊆⊢)⊃⊃⎕NGET '07.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "2a377103-6ac1-4513-8e60-aabeac51e1eb",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "4dd03668-cffc-4d2a-8c5f-9af763d7a9ed",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">340052\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"⌊/{+/|¨⍵-data}¨⍳≢data"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ba873ee7-88c1-48cd-8563-dc48832ad154",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Part 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "39f4060b-fae9-4043-aaf3-fe9b9794716b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<span style=\"white-space:pre; font-family: monospace\">92948968\n",
|
||||
"</span>"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"⌊/{+/(+/⍳)¨|¨⍵-data}¨⍳≢data"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
4
APL/2021/08.apl
Normal file
4
APL/2021/08.apl
Normal file
|
@ -0,0 +1,4 @@
|
|||
input ← (((10⍴1),0,(4⍴1))⊆⊢)¨' '(≠⊆⊢)¨⊃⎕NGET '../.cache/2021/8' 1
|
||||
mat ← ⍎¨10 3⍴'632222521532442531631322742642'
|
||||
⎕ ← +/((2 3 4 7)∊⍨⊢)¨∊≢¨¨⊃↓⍉⌽↑input
|
||||
⎕ ← +/{a b←⍵⋄l←{⊃(⍵=≢¨a)/a}¨4 2⋄10⊥{1-⍨mat⍳(≢⍵)(≢⍵∩⊃l)(≢⍵∩2⊃l)}¨b}¨input
|
|
@ -1,103 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← (((10⍴1),0,(4⍴1))⊆⊢)¨' '(≠⊆⊢)¨⊃⎕NGET '08.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">392\n</span>"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/((2 3 4 7)∊⍨⊢)¨∊≢¨¨⊃↓⍉⌽↑data"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">1004688\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"mat←⍎¨10 3⍴'632222521532442531631322742642'\n",
|
||||
"+/{a b←⍵⋄l←{⊃(⍵=≢¨a)/a}¨4 2⋄10⊥{1-⍨mat⍳(≢⍵)(≢⍵∩⊃l)(≢⍵∩2⊃l)}¨b}¨data"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
5
APL/2021/09.apl
Normal file
5
APL/2021/09.apl
Normal file
|
@ -0,0 +1,5 @@
|
|||
input ← ↑⍎¨¨⊃⎕NGET '../.cache/2021/9' 1
|
||||
low←{w←⍵⋄⊃∧/{w<⍵}¨(⍉9,⍉¯1↓⍵)(⍉9,⍨⍉1↓⍵)(9,⍉¯1↓⍉⍵)(9,⍨⍉1↓⍉⍵)}input
|
||||
⎕ ← +/∊low×input+1
|
||||
dfs ← {x v←⍵⋄(⊂x)∊v:v⋄⊃{~(⊂⍺)∊⍳⍴input:⍵⋄⍺⌷input≥9:⍵⋄dfs ⍺ ⍵}/(((x+⊢)¨(¯1 0)(1 0)(0 1)(0 ¯1)),⊂(v∪⊂x))}
|
||||
⎕ ← ×/3↑{⍵[⍒⍵]}{≢dfs ⍵ (⍳0)}¨⍸low
|
|
@ -1,104 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ↑⍎¨¨⊃⎕NGET '09.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">425\n</span>"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"low←{w←⍵⋄⊃∧/{w<⍵}¨(⍉9,⍉¯1↓⍵)(⍉9,⍨⍉1↓⍵)(9,⍉¯1↓⍉⍵)(9,⍨⍉1↓⍉⍵)}data\n",
|
||||
"+/∊low×data+1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">1135260\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"dfs ← {x v←⍵⋄(⊂x)∊v:v⋄⊃{~(⊂⍺)∊⍳⍴data:⍵⋄⍺⌷data≥9:⍵⋄dfs ⍺ ⍵}/(((x+⊢)¨(¯1 0)(1 0)(0 1)(0 ¯1)),⊂(v∪⊂x))}\n",
|
||||
"×/3↑{⍵[⍒⍵]}{≢dfs ⍵ (⍳0)}¨⍸low"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
4
APL/2021/10.apl
Normal file
4
APL/2021/10.apl
Normal file
|
@ -0,0 +1,4 @@
|
|||
input ← ⊃⎕NGET '../.cache/2021/10' 1
|
||||
⎕PP ← 32
|
||||
⎕ ← +/{{l s←⍵⋄0=≢l:0⋄(⊃l)∊'([{<':∇(1↓l)(s,⍨⊃l)⋄(⊂(⊃s),⊃l)∊('()' '[]' '{}' '<>'):∇(1↓l)(1↓s)⋄⊃(')]}>'=⊃l)/(3 57 1197 25137)}⍵ ''}¨ input
|
||||
⎕ ← {⍵[⍋⍵][⌈2÷⍨≢⍵]}{(⍵≠¯1)/⍵}{{l s←⍵⋄0=≢l:{⍺+5×⍵}/{⊃⍸'([{<'=⊃⍵}¨⌽s⋄(⊃l)∊'([{<':∇(1↓l)(s,⍨⊃l)⋄(⊂(⊃s),⊃l)∊('()' '[]' '{}' '<>'):∇(1↓l)(1↓s)⋄¯1}⍵ ''}¨ input
|
|
@ -1,103 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⊃⎕NGET '10.txt' 1\n",
|
||||
"⎕PP ← 32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">278475\n</span>"
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/{{l s←⍵⋄0=≢l:0⋄(⊃l)∊'([{<':∇(1↓l)(s,⍨⊃l)⋄(⊂(⊃s),⊃l)∊('()' '[]' '{}' '<>'):∇(1↓l)(1↓s)⋄⊃(')]}>'=⊃l)/(3 57 1197 25137)}⍵ ''}¨data"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">3015539998\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{⍵[⍋⍵][⌈2÷⍨≢⍵]}{(⍵≠¯1)/⍵}{{l s←⍵⋄0=≢l:{⍺+5×⍵}/{⊃⍸'([{<'=⊃⍵}¨⌽s⋄(⊃l)∊'([{<':∇(1↓l)(s,⍨⊃l)⋄(⊂(⊃s),⊃l)∊('()' '[]' '{}' '<>'):∇(1↓l)(1↓s)⋄¯1}⍵ ''}¨data"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
9
APL/2021/11.apl
Normal file
9
APL/2021/11.apl
Normal file
|
@ -0,0 +1,9 @@
|
|||
input ← ⍎¨¨⊃⎕NGET '../.cache/2021/11' 1
|
||||
up←{⍉0,⍨⍉1↓⍵}
|
||||
down←{⍉0,⍉¯1↓⍵}
|
||||
left←{0,⍨⍉1↓⍉⍵}
|
||||
right←{0,⍉¯1↓⍉⍵}
|
||||
ff←{10≠⍵}×{10⌊⍵+(⍵>0)∧(⊢+left+right)(⊢+up+down)10=⍵}
|
||||
step←{{a b←⍵⋄a≡b:a⋄∇(ff a)a}1+⍵ 0}
|
||||
⎕ ← {d n←⍵⋄n>100:0⋄(⊂+/0=∊d)+∇(step d)(n+1)}(↑input) 0
|
||||
⎕ ← {d n←⍵⋄~∨/∊d:n⋄∇(step d)(n+1)}(↑input) 0
|
|
@ -1,121 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⍎¨¨⊃⎕NGET '11.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"up←{⍉0,⍨⍉1↓⍵}\n",
|
||||
"down←{⍉0,⍉¯1↓⍵}\n",
|
||||
"left←{0,⍨⍉1↓⍉⍵}\n",
|
||||
"right←{0,⍉¯1↓⍉⍵}\n",
|
||||
"ff←{10≠⍵}×{10⌊⍵+(⍵>0)∧(⊢+left+right)(⊢+up+down)10=⍵}\n",
|
||||
"step←{{a b←⍵⋄a≡b:a⋄∇(ff a)a}1+⍵ 0}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">1659\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{d n←⍵⋄n>100:0⋄(⊂+/0=∊d)+∇(step d)(n+1)}(↑data) 0"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">227\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"{d n←⍵⋄~∨/∊d:n⋄∇(step d)(n+1)}(↑data) 0"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
5
APL/2021/12.apl
Normal file
5
APL/2021/12.apl
Normal file
|
@ -0,0 +1,5 @@
|
|||
input ← '-'(≠⊆⊢)¨⊃⎕NGET '../.cache/2021/12' 1
|
||||
next ← {w←⍵⋄⊃{a b←⍺⋄a≡w:⍵,⊂b⋄b≡w:⍵,⊂a⋄⍵}/input,⊂⍬}
|
||||
search ← {p v s←⍵⋄p≡'end':1⋄t←(∧/97≤⎕UCS p)∧∨/(p≡⊢)¨v⋄t∧s∨p≡'start':0⋄+/{search ⍵ (v∪⊂p) (t∨s)}¨next p}
|
||||
⎕ ← search 'start' ⍬ 1
|
||||
⎕ ← search 'start' ⍬ 0
|
|
@ -1,117 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← '-'(≠⊆⊢)¨⊃⎕NGET '12.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"next ← {w←⍵⋄⊃{a b←⍺⋄a≡w:⍵,⊂b⋄b≡w:⍵,⊂a⋄⍵}/data,⊂⍬}\n",
|
||||
"search ← {p v s←⍵⋄p≡'end':1⋄t←(∧/97≤⎕UCS p)∧∨/(p≡⊢)¨v⋄t∧s∨p≡'start':0⋄+/{search ⍵ (v∪⊂p) (t∨s)}¨next p}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">3679\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"search 'start' ⍬ 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">107395\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"search 'start' ⍬ 0"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
8
APL/2021/13.apl
Normal file
8
APL/2021/13.apl
Normal file
|
@ -0,0 +1,8 @@
|
|||
dots folds ← {⍵⊆⍨0≠≢¨⍵}⊃⎕NGET '../.cache/2021/13' 1
|
||||
dots ← {⍎¨','(≠⊆⊢)⍵}¨dots
|
||||
folds ← {c n←'='(≠⊆⊢)⊃⌽' '(≠⊆⊢)⍵⋄(⊃c)(⍎n)}¨folds
|
||||
fold ← {c n←2⊃⍵⋄∪{x y←⍵⋄c≡'y':x(y⌊n+n-y)⋄(x⌊n+n-x)y}¨⊃⍵}
|
||||
⎕ ← ≢fold dots (⊃folds)
|
||||
dots ← ⊃{fold ⍵ ⍺}/(⌽folds),⊂dots
|
||||
w h ← ⊃⌈/dots
|
||||
⎕ ← ↑↑{,/⍵}¨↓{(⊂⌽⍵)∊dots:'##'⋄' '}¨1-⍨⍳(h+1)(w+1)
|
|
@ -1,120 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"dots folds ← {⍵⊆⍨0≠≢¨⍵}⊃⎕NGET '13.txt' 1\n",
|
||||
"dots ← {⍎¨','(≠⊆⊢)⍵}¨dots\n",
|
||||
"folds ← {c n←'='(≠⊆⊢)⊃⌽' '(≠⊆⊢)⍵⋄(⊃c)(⍎n)}¨folds"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"fold ← {c n←2⊃⍵⋄∪{x y←⍵⋄c≡'y':x(y⌊n+n-y)⋄(x⌊n+n-x)y}¨⊃⍵}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">747\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"≢fold dots (⊃folds)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": " #### ###### ## ## ######## ###### #### ## ## ## ##\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## ## ## ## ######## ## ## ## ## ## ## ########\n######## ###### ## ## ## ###### ## ## ## ## ##\n## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## ## ## ## ## ## ######## ## #### #### ## ##"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"dots ← ⊃{fold ⍵ ⍺}/(⌽folds),⊂dots\n",
|
||||
"w h ← ⊃⌈/dots\n",
|
||||
"↑↑{,/⍵}¨↓{(⊂⌽⍵)∊dots:'##'⋄' '}¨1-⍨⍳(h+1)(w+1)"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
9
APL/2021/14.apl
Normal file
9
APL/2021/14.apl
Normal file
|
@ -0,0 +1,9 @@
|
|||
input ← ⊃⎕NGET '../.cache/2021/14' 1
|
||||
⎕PP ← 32
|
||||
template ← ⊃input
|
||||
rules ← {(⍵⌷⍨⊢)¨1 2 7}¨2↓input
|
||||
gr ← {k←⍵⋄{⊃⌽⊃⍵/⍨{k≡2↑⍵}¨⍵}rules}
|
||||
next ← {{w←⍵⋄∪{k←⍵⋄⍵ (+/{(2⊃⍵)×k≡⊃⍵}¨w)}¨{⊃⍵}¨w}⊃,/{(a b) c←⍵⋄x←gr ⊃⍵⋄((a x)c)((x b)c)}¨⍵}
|
||||
solve ← {{(⌈/⍵)-(⌊/⍵)}⊃⌽↓⍉{a b←⍵⋄({⊃⌽⍵}¨a) {⍺,+/⍵}⌸ b}↓⍉↑ (⊂((1↑template) 1)),(next⍣⍵) ↓{(⊃⍺)(≢⍵)}⌸2,/template}
|
||||
⎕ ← solve 10
|
||||
⎕ ← solve 40
|
|
@ -1,122 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⊃⎕NGET '14.txt' 1\n",
|
||||
"⎕PP ← 32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"template ← ⊃data\n",
|
||||
"rules ← {(⍵⌷⍨⊢)¨1 2 7}¨2↓data\n",
|
||||
"\n",
|
||||
"gr ← {k←⍵⋄{⊃⌽⊃⍵/⍨{k≡2↑⍵}¨⍵}rules}\n",
|
||||
"next ← {{w←⍵⋄∪{k←⍵⋄⍵ (+/{(2⊃⍵)×k≡⊃⍵}¨w)}¨{⊃⍵}¨w}⊃,/{(a b) c←⍵⋄x←gr ⊃⍵⋄((a x)c)((x b)c)}¨⍵}\n",
|
||||
"solve ← {{(⌈/⍵)-(⌊/⍵)}⊃⌽↓⍉{a b←⍵⋄({⊃⌽⍵}¨a) {⍺,+/⍵}⌸ b}↓⍉↑ (⊂((1↑template) 1)),(next⍣⍵) ↓{(⊃⍺)(≢⍵)}⌸2,/template}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">3247\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve 10"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">4110568157153\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve 40"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
4
APL/2021/15.apl
Normal file
4
APL/2021/15.apl
Normal file
|
@ -0,0 +1,4 @@
|
|||
input ← ↑⍎¨¨⊃⎕NGET '../.cache/2021/15' 1
|
||||
solve←{d←⍵⋄h w←⍴d⋄max←+/∊d⋄⊃⌽∊({⊃⌊/⍵ (d+{⍉max,⍉¯1↓⍵}⍵)(d+{⍉max,⍨⍉1↓⍵}⍵)(d+{max,⍉¯1↓⍉⍵}⍵)(d+{max,⍨⍉1↓⍉⍵}⍵)}⍣(2×w+h))h w⍴0,(1-⍨w×h)⍴max}
|
||||
⎕ ← solve input
|
||||
⎕ ← solve ⍉⊃,/⍉¨,⌿⍉{1+⍨9|1-⍨input++/⍵}¨1-⍨⍳5 5
|
|
@ -1,116 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ↑⍎¨¨⊃⎕NGET '15.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"solve←{d←⍵⋄h w←⍴d⋄max←+/∊d⋄⊃⌽∊({⊃⌊/⍵ (d+{⍉max,⍉¯1↓⍵}⍵)(d+{⍉max,⍨⍉1↓⍵}⍵)(d+{max,⍉¯1↓⍉⍵}⍵)(d+{max,⍨⍉1↓⍉⍵}⍵)}⍣(2×w+h))h w⍴0,(1-⍨w×h)⍴max}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">366\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve data"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">2829\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"solve ⍉⊃,/⍉¨,⌿⍉{1+⍨9|1-⍨data++/⍵}¨1-⍨⍳5 5"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
12
APL/2021/16.apl
Normal file
12
APL/2021/16.apl
Normal file
|
@ -0,0 +1,12 @@
|
|||
input ← ⊃,/{⍵⊤⍨4⍴2}¨1-⍨('0123456789ABCDEF'⍸⊢)¨⊃⊃⎕NGET '../.cache/2021/16' 1
|
||||
⎕PP ← 32
|
||||
read ← {a b←⍵⋄2⊥input[1-⍨a+⍳b]}
|
||||
rl ← {i x←⍵⋄c←read i 1⋄x←(x×16)+read(i+1)4⋄~c:(i+5)x⋄∇(i+5)x}
|
||||
gv0 ← {{i c←⍵⋄i≥c:i 0 ⍬⋄i v x←solve i⋄i vs xs←∇i c⋄i(v+vs)(x,xs)}(⍵+15)(⍵+15+read ⍵ 15)}
|
||||
gv1 ← {{i c←⍵⋄c≤0:i 0 ⍬⋄i v x←solve i⋄i vs xs←∇i(c-1)⋄i(v+vs)(x,xs)}(⍵+11)(read ⍵ 11)}
|
||||
gv ← {0=read ⍵ 1:gv0 (⍵+1)⋄gv1 (⍵+1)}
|
||||
op ← {t x←⍵⋄t=0:⊃+/x⋄t=1:⊃×/x⋄t=2:⊃⌊/x⋄t=3:⊃⌈/x⋄t=5:(⊃x)>2⊃x⋄t=6:(⊃x)<2⊃x⋄t=7:(⊃x)=2⊃x}
|
||||
solve ← {i←⍵⋄v←read i 3⋄i←i+3⋄t←read i 3⋄i←i+3⋄t=4:{i x←⍵⋄i v x}rl i 0⋄i vs xs←gv i⋄i(v+vs)(op t xs)}
|
||||
_ part1 part2 ← solve 1
|
||||
⎕ ← part1
|
||||
⎕ ← part2
|
|
@ -1,124 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"data ← ⊃,/{⍵⊤⍨4⍴2}¨1-⍨('0123456789ABCDEF'⍸⊢)¨⊃⊃⎕NGET '16.txt' 1\n",
|
||||
"⎕PP ← 32"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"read ← {a b←⍵⋄2⊥data[1-⍨a+⍳b]}\n",
|
||||
"rl ← {i x←⍵⋄c←read i 1⋄x←(x×16)+read(i+1)4⋄~c:(i+5)x⋄∇(i+5)x}\n",
|
||||
"gv0 ← {{i c←⍵⋄i≥c:i 0 ⍬⋄i v x←solve i⋄i vs xs←∇i c⋄i(v+vs)(x,xs)}(⍵+15)(⍵+15+read ⍵ 15)}\n",
|
||||
"gv1 ← {{i c←⍵⋄c≤0:i 0 ⍬⋄i v x←solve i⋄i vs xs←∇i(c-1)⋄i(v+vs)(x,xs)}(⍵+11)(read ⍵ 11)}\n",
|
||||
"gv ← {0=read ⍵ 1:gv0 (⍵+1)⋄gv1 (⍵+1)}\n",
|
||||
"op ← {t x←⍵⋄t=0:⊃+/x⋄t=1:⊃×/x⋄t=2:⊃⌊/x⋄t=3:⊃⌈/x⋄t=5:(⊃x)>2⊃x⋄t=6:(⊃x)<2⊃x⋄t=7:(⊃x)=2⊃x}\n",
|
||||
"solve ← {i←⍵⋄v←read i 3⋄i←i+3⋄t←read i 3⋄i←i+3⋄t=4:{i x←⍵⋄i v x}rl i 0⋄i vs xs←gv i⋄i(v+vs)(op t xs)}\n",
|
||||
"_ part1 part2 ← solve 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">906\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"part1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">819324480368\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"part2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
4
APL/2021/17.apl
Normal file
4
APL/2021/17.apl
Normal file
|
@ -0,0 +1,4 @@
|
|||
(x1 x2) (y1 y2) ← {⍎¨'.'(≠⊆⊢)⊃','(≠⊆⊢)⍵}¨1↓'='(≠⊆⊢)⊃⊃⎕NGET '../.cache/2021/17' 1
|
||||
s ← {w←{x y vx vy←⍵⋄(x>x2)∨(y<y1):⍬⋄(⊂x y),∇(x+vx)(y+vy)(vx-×vx)(vy-1)}(0 0),⍵⋄(⊃⌈⌿⌽↑w)(⊃∧/{((x2 y2)≥⍵)∧(x1 y1)≤⍵}⊃⌽w)}
|
||||
⎕ ← ⌈/∊{vy←⍵⋄{vx←⍵⋄y k←s vx vy⋄k×y}¨⍳x2}¨1-⍨y1+⍳500+1-y1
|
||||
⎕ ← +/∊{vy←⍵⋄{vx←⍵⋄y k←s vx vy⋄k}¨⍳x2}¨1-⍨y1+⍳500+1-y1
|
|
@ -1,116 +0,0 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "8fb56a69-e2e3-4a2e-9257-c78046f23f21",
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"(x1 x2) (y1 y2) ← {⍎¨'.'(≠⊆⊢)⊃','(≠⊆⊢)⍵}¨1↓'='(≠⊆⊢)⊃⊃⎕NGET '17.txt' 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"s ← {w←{x y vx vy←⍵⋄(x>x2)∨(y<y1):⍬⋄(⊂x y),∇(x+vx)(y+vy)(vx-×vx)(vy-1)}(0 0),⍵⋄(⊃⌈⌿⌽↑w)(⊃∧/{((x2 y2)≥⍵)∧(x1 y1)≤⍵}⊃⌽w)}"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">3916\n</span>"
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"⌈/∊{vy←⍵⋄{vx←⍵⋄y k←s vx vy⋄k×y}¨⍳x2}¨1-⍨y1+⍳500+1-y1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Part 2"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": "<span style=\"white-space:pre; font-family: monospace\">2986\n</span>"
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"+/∊{vy←⍵⋄{vx←⍵⋄y k←s vx vy⋄k}¨⍳x2}¨1-⍨y1+⍳500+1-y1"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Dyalog APL",
|
||||
"language": "apl",
|
||||
"name": "dyalog-kernel"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".apl",
|
||||
"mimetype": "text/apl",
|
||||
"name": "APL"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
19
APL/justfile
Normal file
19
APL/justfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
alias r := run
|
||||
alias t := test
|
||||
alias ty := test-year
|
||||
alias ta := test-all
|
||||
|
||||
_default:
|
||||
@just --list
|
||||
|
||||
run year day:
|
||||
dyalogscript {{year}}/{{day}}.apl
|
||||
|
||||
test year day:
|
||||
@diff <(just run {{year}} {{day}}) <(cat ../.cache/{{year}}/{{trim_start_match(day, "0")}}.{1,2})
|
||||
|
||||
test-year year:
|
||||
@set -e; for day in $(ls {{year}}); do just test {{year}} $(basename $day .apl); done
|
||||
|
||||
test-all:
|
||||
@set -e; for year in *; do [[ -d $year ]] || continue; just test-year $year; done
|
|
@ -13,9 +13,9 @@
|
|||
## [2021](https://adventofcode.com/2021) ([<img height=18 src=".assets/rs.svg"> Rust](Rust/2021): 25/25 | [<img height=18 src=".assets/py.svg"> Python](Python/2021): 25/25 | [<img height=18 src=".assets/apl.svg"> APL](APL/2021): 17/25)
|
||||
|Mo|Tu|We|Th|Fr|Sa|Su|
|
||||
|-|-|-|-|-|-|-|
|
||||
|||[**1**](https://adventofcode.com/2021/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2021/01.rs "Rust solution for 2021/01") [<img height=12 src=".assets/py.svg">](Python/2021/01.ipynb "Python solution for 2021/01") [<img height=12 src=".assets/apl.svg">](APL/2021/01.ipynb "APL solution for 2021/01")|[**2**](https://adventofcode.com/2021/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2021/02.rs "Rust solution for 2021/02") [<img height=12 src=".assets/py.svg">](Python/2021/02.ipynb "Python solution for 2021/02") [<img height=12 src=".assets/apl.svg">](APL/2021/02.ipynb "APL solution for 2021/02")|[**3**](https://adventofcode.com/2021/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2021/03.rs "Rust solution for 2021/03") [<img height=12 src=".assets/py.svg">](Python/2021/03.ipynb "Python solution for 2021/03") [<img height=12 src=".assets/apl.svg">](APL/2021/03.ipynb "APL solution for 2021/03")|[**4**](https://adventofcode.com/2021/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2021/04.rs "Rust solution for 2021/04") [<img height=12 src=".assets/py.svg">](Python/2021/04.ipynb "Python solution for 2021/04") [<img height=12 src=".assets/apl.svg">](APL/2021/04.ipynb "APL solution for 2021/04")|[**5**](https://adventofcode.com/2021/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2021/05.rs "Rust solution for 2021/05") [<img height=12 src=".assets/py.svg">](Python/2021/05.ipynb "Python solution for 2021/05") [<img height=12 src=".assets/apl.svg">](APL/2021/05.ipynb "APL solution for 2021/05")|
|
||||
|[**6**](https://adventofcode.com/2021/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2021/06.rs "Rust solution for 2021/06") [<img height=12 src=".assets/py.svg">](Python/2021/06.ipynb "Python solution for 2021/06") [<img height=12 src=".assets/apl.svg">](APL/2021/06.ipynb "APL solution for 2021/06")|[**7**](https://adventofcode.com/2021/day/7) [<img height=12 src=".assets/rs.svg">](Rust/2021/07.rs "Rust solution for 2021/07") [<img height=12 src=".assets/py.svg">](Python/2021/07.ipynb "Python solution for 2021/07") [<img height=12 src=".assets/apl.svg">](APL/2021/07.ipynb "APL solution for 2021/07")|[**8**](https://adventofcode.com/2021/day/8) [<img height=12 src=".assets/rs.svg">](Rust/2021/08.rs "Rust solution for 2021/08") [<img height=12 src=".assets/py.svg">](Python/2021/08.ipynb "Python solution for 2021/08") [<img height=12 src=".assets/apl.svg">](APL/2021/08.ipynb "APL solution for 2021/08")|[**9**](https://adventofcode.com/2021/day/9) [<img height=12 src=".assets/rs.svg">](Rust/2021/09.rs "Rust solution for 2021/09") [<img height=12 src=".assets/py.svg">](Python/2021/09.ipynb "Python solution for 2021/09") [<img height=12 src=".assets/apl.svg">](APL/2021/09.ipynb "APL solution for 2021/09")|[**10**](https://adventofcode.com/2021/day/10) [<img height=12 src=".assets/rs.svg">](Rust/2021/10.rs "Rust solution for 2021/10") [<img height=12 src=".assets/py.svg">](Python/2021/10.ipynb "Python solution for 2021/10") [<img height=12 src=".assets/apl.svg">](APL/2021/10.ipynb "APL solution for 2021/10")|[**11**](https://adventofcode.com/2021/day/11) [<img height=12 src=".assets/rs.svg">](Rust/2021/11.rs "Rust solution for 2021/11") [<img height=12 src=".assets/py.svg">](Python/2021/11.ipynb "Python solution for 2021/11") [<img height=12 src=".assets/apl.svg">](APL/2021/11.ipynb "APL solution for 2021/11")|[**12**](https://adventofcode.com/2021/day/12) [<img height=12 src=".assets/rs.svg">](Rust/2021/12.rs "Rust solution for 2021/12") [<img height=12 src=".assets/py.svg">](Python/2021/12.ipynb "Python solution for 2021/12") [<img height=12 src=".assets/apl.svg">](APL/2021/12.ipynb "APL solution for 2021/12")|
|
||||
|[**13**](https://adventofcode.com/2021/day/13) [<img height=12 src=".assets/rs.svg">](Rust/2021/13.rs "Rust solution for 2021/13") [<img height=12 src=".assets/py.svg">](Python/2021/13.ipynb "Python solution for 2021/13") [<img height=12 src=".assets/apl.svg">](APL/2021/13.ipynb "APL solution for 2021/13")|[**14**](https://adventofcode.com/2021/day/14) [<img height=12 src=".assets/rs.svg">](Rust/2021/14.rs "Rust solution for 2021/14") [<img height=12 src=".assets/py.svg">](Python/2021/14.ipynb "Python solution for 2021/14") [<img height=12 src=".assets/apl.svg">](APL/2021/14.ipynb "APL solution for 2021/14")|[**15**](https://adventofcode.com/2021/day/15) [<img height=12 src=".assets/rs.svg">](Rust/2021/15.rs "Rust solution for 2021/15") [<img height=12 src=".assets/py.svg">](Python/2021/15.ipynb "Python solution for 2021/15") [<img height=12 src=".assets/apl.svg">](APL/2021/15.ipynb "APL solution for 2021/15")|[**16**](https://adventofcode.com/2021/day/16) [<img height=12 src=".assets/rs.svg">](Rust/2021/16.rs "Rust solution for 2021/16") [<img height=12 src=".assets/py.svg">](Python/2021/16.ipynb "Python solution for 2021/16") [<img height=12 src=".assets/apl.svg">](APL/2021/16.ipynb "APL solution for 2021/16")|[**17**](https://adventofcode.com/2021/day/17) [<img height=12 src=".assets/rs.svg">](Rust/2021/17.rs "Rust solution for 2021/17") [<img height=12 src=".assets/py.svg">](Python/2021/17.ipynb "Python solution for 2021/17") [<img height=12 src=".assets/apl.svg">](APL/2021/17.ipynb "APL solution for 2021/17")|[**18**](https://adventofcode.com/2021/day/18) [<img height=12 src=".assets/rs.svg">](Rust/2021/18.rs "Rust solution for 2021/18") [<img height=12 src=".assets/py.svg">](Python/2021/18.ipynb "Python solution for 2021/18")|[**19**](https://adventofcode.com/2021/day/19) [<img height=12 src=".assets/rs.svg">](Rust/2021/19.rs "Rust solution for 2021/19") [<img height=12 src=".assets/py.svg">](Python/2021/19.ipynb "Python solution for 2021/19")|
|
||||
|||[**1**](https://adventofcode.com/2021/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2021/01.rs "Rust solution for 2021/01") [<img height=12 src=".assets/py.svg">](Python/2021/01.ipynb "Python solution for 2021/01") [<img height=12 src=".assets/apl.svg">](APL/2021/01.apl "APL solution for 2021/01")|[**2**](https://adventofcode.com/2021/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2021/02.rs "Rust solution for 2021/02") [<img height=12 src=".assets/py.svg">](Python/2021/02.ipynb "Python solution for 2021/02") [<img height=12 src=".assets/apl.svg">](APL/2021/02.apl "APL solution for 2021/02")|[**3**](https://adventofcode.com/2021/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2021/03.rs "Rust solution for 2021/03") [<img height=12 src=".assets/py.svg">](Python/2021/03.ipynb "Python solution for 2021/03") [<img height=12 src=".assets/apl.svg">](APL/2021/03.apl "APL solution for 2021/03")|[**4**](https://adventofcode.com/2021/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2021/04.rs "Rust solution for 2021/04") [<img height=12 src=".assets/py.svg">](Python/2021/04.ipynb "Python solution for 2021/04") [<img height=12 src=".assets/apl.svg">](APL/2021/04.apl "APL solution for 2021/04")|[**5**](https://adventofcode.com/2021/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2021/05.rs "Rust solution for 2021/05") [<img height=12 src=".assets/py.svg">](Python/2021/05.ipynb "Python solution for 2021/05") [<img height=12 src=".assets/apl.svg">](APL/2021/05.apl "APL solution for 2021/05")|
|
||||
|[**6**](https://adventofcode.com/2021/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2021/06.rs "Rust solution for 2021/06") [<img height=12 src=".assets/py.svg">](Python/2021/06.ipynb "Python solution for 2021/06") [<img height=12 src=".assets/apl.svg">](APL/2021/06.apl "APL solution for 2021/06")|[**7**](https://adventofcode.com/2021/day/7) [<img height=12 src=".assets/rs.svg">](Rust/2021/07.rs "Rust solution for 2021/07") [<img height=12 src=".assets/py.svg">](Python/2021/07.ipynb "Python solution for 2021/07") [<img height=12 src=".assets/apl.svg">](APL/2021/07.apl "APL solution for 2021/07")|[**8**](https://adventofcode.com/2021/day/8) [<img height=12 src=".assets/rs.svg">](Rust/2021/08.rs "Rust solution for 2021/08") [<img height=12 src=".assets/py.svg">](Python/2021/08.ipynb "Python solution for 2021/08") [<img height=12 src=".assets/apl.svg">](APL/2021/08.apl "APL solution for 2021/08")|[**9**](https://adventofcode.com/2021/day/9) [<img height=12 src=".assets/rs.svg">](Rust/2021/09.rs "Rust solution for 2021/09") [<img height=12 src=".assets/py.svg">](Python/2021/09.ipynb "Python solution for 2021/09") [<img height=12 src=".assets/apl.svg">](APL/2021/09.apl "APL solution for 2021/09")|[**10**](https://adventofcode.com/2021/day/10) [<img height=12 src=".assets/rs.svg">](Rust/2021/10.rs "Rust solution for 2021/10") [<img height=12 src=".assets/py.svg">](Python/2021/10.ipynb "Python solution for 2021/10") [<img height=12 src=".assets/apl.svg">](APL/2021/10.apl "APL solution for 2021/10")|[**11**](https://adventofcode.com/2021/day/11) [<img height=12 src=".assets/rs.svg">](Rust/2021/11.rs "Rust solution for 2021/11") [<img height=12 src=".assets/py.svg">](Python/2021/11.ipynb "Python solution for 2021/11") [<img height=12 src=".assets/apl.svg">](APL/2021/11.apl "APL solution for 2021/11")|[**12**](https://adventofcode.com/2021/day/12) [<img height=12 src=".assets/rs.svg">](Rust/2021/12.rs "Rust solution for 2021/12") [<img height=12 src=".assets/py.svg">](Python/2021/12.ipynb "Python solution for 2021/12") [<img height=12 src=".assets/apl.svg">](APL/2021/12.apl "APL solution for 2021/12")|
|
||||
|[**13**](https://adventofcode.com/2021/day/13) [<img height=12 src=".assets/rs.svg">](Rust/2021/13.rs "Rust solution for 2021/13") [<img height=12 src=".assets/py.svg">](Python/2021/13.ipynb "Python solution for 2021/13") [<img height=12 src=".assets/apl.svg">](APL/2021/13.apl "APL solution for 2021/13")|[**14**](https://adventofcode.com/2021/day/14) [<img height=12 src=".assets/rs.svg">](Rust/2021/14.rs "Rust solution for 2021/14") [<img height=12 src=".assets/py.svg">](Python/2021/14.ipynb "Python solution for 2021/14") [<img height=12 src=".assets/apl.svg">](APL/2021/14.apl "APL solution for 2021/14")|[**15**](https://adventofcode.com/2021/day/15) [<img height=12 src=".assets/rs.svg">](Rust/2021/15.rs "Rust solution for 2021/15") [<img height=12 src=".assets/py.svg">](Python/2021/15.ipynb "Python solution for 2021/15") [<img height=12 src=".assets/apl.svg">](APL/2021/15.apl "APL solution for 2021/15")|[**16**](https://adventofcode.com/2021/day/16) [<img height=12 src=".assets/rs.svg">](Rust/2021/16.rs "Rust solution for 2021/16") [<img height=12 src=".assets/py.svg">](Python/2021/16.ipynb "Python solution for 2021/16") [<img height=12 src=".assets/apl.svg">](APL/2021/16.apl "APL solution for 2021/16")|[**17**](https://adventofcode.com/2021/day/17) [<img height=12 src=".assets/rs.svg">](Rust/2021/17.rs "Rust solution for 2021/17") [<img height=12 src=".assets/py.svg">](Python/2021/17.ipynb "Python solution for 2021/17") [<img height=12 src=".assets/apl.svg">](APL/2021/17.apl "APL solution for 2021/17")|[**18**](https://adventofcode.com/2021/day/18) [<img height=12 src=".assets/rs.svg">](Rust/2021/18.rs "Rust solution for 2021/18") [<img height=12 src=".assets/py.svg">](Python/2021/18.ipynb "Python solution for 2021/18")|[**19**](https://adventofcode.com/2021/day/19) [<img height=12 src=".assets/rs.svg">](Rust/2021/19.rs "Rust solution for 2021/19") [<img height=12 src=".assets/py.svg">](Python/2021/19.ipynb "Python solution for 2021/19")|
|
||||
|[**20**](https://adventofcode.com/2021/day/20) [<img height=12 src=".assets/rs.svg">](Rust/2021/20.rs "Rust solution for 2021/20") [<img height=12 src=".assets/py.svg">](Python/2021/20.ipynb "Python solution for 2021/20")|[**21**](https://adventofcode.com/2021/day/21) [<img height=12 src=".assets/rs.svg">](Rust/2021/21.rs "Rust solution for 2021/21") [<img height=12 src=".assets/py.svg">](Python/2021/21.ipynb "Python solution for 2021/21")|[**22**](https://adventofcode.com/2021/day/22) [<img height=12 src=".assets/rs.svg">](Rust/2021/22.rs "Rust solution for 2021/22") [<img height=12 src=".assets/py.svg">](Python/2021/22.ipynb "Python solution for 2021/22")|[**23**](https://adventofcode.com/2021/day/23) [<img height=12 src=".assets/rs.svg">](Rust/2021/23.rs "Rust solution for 2021/23") [<img height=12 src=".assets/py.svg">](Python/2021/23.ipynb "Python solution for 2021/23")|[**24**](https://adventofcode.com/2021/day/24) [<img height=12 src=".assets/rs.svg">](Rust/2021/24.rs "Rust solution for 2021/24") [<img height=12 src=".assets/py.svg">](Python/2021/24.ipynb "Python solution for 2021/24")|[**25**](https://adventofcode.com/2021/day/25) [<img height=12 src=".assets/rs.svg">](Rust/2021/25.rs "Rust solution for 2021/25") [<img height=12 src=".assets/py.svg">](Python/2021/25.ipynb "Python solution for 2021/25")|26|
|
||||
|27|28|29|30|31|||
|
||||
|
||||
|
|
13
flake.nix
13
flake.nix
|
@ -5,7 +5,13 @@
|
|||
|
||||
outputs = {nixpkgs, ...}: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfreePredicate = pkg:
|
||||
builtins.elem (nixpkgs.lib.getName pkg) [
|
||||
"dyalog"
|
||||
];
|
||||
};
|
||||
|
||||
downloadInput = pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "aoc-download-input";
|
||||
|
@ -56,6 +62,11 @@
|
|||
(haskellPackages.ghcWithPackages (p: with p; [regex-tdfa]))
|
||||
haskell-language-server
|
||||
ormolu # haskell code formatter
|
||||
|
||||
# APL
|
||||
(dyalog.override {
|
||||
acceptLicense = true;
|
||||
})
|
||||
];
|
||||
PYTHONPATH = ".";
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@ from datetime import date
|
|||
from pathlib import Path
|
||||
|
||||
names = {"rs": "Rust", "hs": "Haskell", "py": "Python", "apl": "APL"}
|
||||
exts = {"rs": [".rs"], "hs": [".hs"], "py": [".py", ".ipynb", ""], "apl": [".ipynb"]}
|
||||
exts = {"rs": [".rs"], "hs": [".hs"], "py": [".py", ".ipynb", ""], "apl": [".apl"]}
|
||||
|
||||
|
||||
def logo(lang, height=12):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue