[Nu/2015/01] Add solution
This commit is contained in:
parent
483ee784a6
commit
13263c1487
6 changed files with 88 additions and 5 deletions
47
.assets/nu.svg
Normal file
47
.assets/nu.svg
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
version="1.0"
|
||||
width="240.000000pt"
|
||||
height="240.000000pt"
|
||||
viewBox="0 0 240.000000 240.000000"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
id="svg1"
|
||||
sodipodi:docname="icon.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="pt"
|
||||
inkscape:zoom="0.7375"
|
||||
inkscape:cx="160"
|
||||
inkscape:cy="160"
|
||||
inkscape:window-width="2048"
|
||||
inkscape:window-height="1260"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg1" />
|
||||
<g
|
||||
transform="translate(0.000000,240.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000"
|
||||
stroke="none"
|
||||
id="g1"
|
||||
style="fill:#4e9a06;fill-opacity:1">
|
||||
<path
|
||||
d="M544 2108 c-37 -57 -69 -110 -71 -118 -3 -12 163 -119 611 -394 339 -209 616 -382 616 -385 0 -3 -277 -177 -615 -385 -338 -208 -615 -383 -615 -387 0 -15 151 -219 161 -219 6 0 311 188 680 418 l669 417 -2 158 -3 159 -675 419 c-371 230 -678 419 -682 419 -4 0 -38 -46 -74 -102z"
|
||||
id="path1"
|
||||
style="fill:#4e9a06;fill-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
10
Nu/2015/01.nu
Normal file
10
Nu/2015/01.nu
Normal file
|
@ -0,0 +1,10 @@
|
|||
use std
|
||||
|
||||
def main [input] {
|
||||
open --raw $input
|
||||
| split chars
|
||||
| each { match $in { '(' => 1, ')' => -1 } }
|
||||
| std iter scan 0 {|it, acc| $it + $acc }
|
||||
| tee { last | print }
|
||||
| std iter find-index {|x| $x == -1 }
|
||||
}
|
23
Nu/justfile
Normal file
23
Nu/justfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
alias r := run
|
||||
alias e := example
|
||||
alias t := test
|
||||
alias ty := test-year
|
||||
alias ta := test-all
|
||||
|
||||
_default:
|
||||
@just --list
|
||||
|
||||
run year day:
|
||||
nu {{year}}/{{day}}.nu ../.cache/{{year}}/{{trim_start_match(day, "0")}}
|
||||
|
||||
example year day ex:
|
||||
nu {{year}}/{{day}}.nu ../examples/{{year}}/{{trim_start_match(day, "0")}}/{{ex}}
|
||||
|
||||
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 .nu); done
|
||||
|
||||
test-all:
|
||||
@set -e; for year in *; do [[ -d $year ]] && [[ "$year" != "lib" ]] || continue; just test-year $year; done
|
|
@ -1,5 +1,5 @@
|
|||
# AdventOfCode
|
||||
[Advent of Code](https://adventofcode.com/) solutions in [<img height=12 src=".assets/rs.svg"> Rust](Rust), [<img height=12 src=".assets/hs.svg"> Haskell](Haskell), [<img height=12 src=".assets/py.svg"> Python](Python), [<img height=12 src=".assets/apl.svg"> APL](APL), [<img height=12 src=".assets/ua.png"> Uiua](Uiua) and [<img height=12 src=".assets/nix.svg"> Nix](Nix)
|
||||
[Advent of Code](https://adventofcode.com/) solutions in [<img height=12 src=".assets/rs.svg"> Rust](Rust), [<img height=12 src=".assets/hs.svg"> Haskell](Haskell), [<img height=12 src=".assets/py.svg"> Python](Python), [<img height=12 src=".assets/apl.svg"> APL](APL), [<img height=12 src=".assets/ua.png"> Uiua](Uiua), [<img height=12 src=".assets/nix.svg"> Nix](Nix) and [<img height=12 src=".assets/nu.svg"> Nu](Nu)
|
||||
|
||||
### Global Leaderboard Placement
|
||||
|Year|Rank|Score|Top% (Leaderboard)|Top% (All participants)|
|
||||
|
@ -83,10 +83,10 @@
|
|||
|[**19**](https://adventofcode.com/2016/day/19) [<img height=12 src=".assets/py.svg">](Python/2016/19.py "Python solution for 2016/19")|[**20**](https://adventofcode.com/2016/day/20) [<img height=12 src=".assets/py.svg">](Python/2016/20.py "Python solution for 2016/20")|[**21**](https://adventofcode.com/2016/day/21) [<img height=12 src=".assets/py.svg">](Python/2016/21.py "Python solution for 2016/21")|[**22**](https://adventofcode.com/2016/day/22) [<img height=12 src=".assets/py.svg">](Python/2016/22.py "Python solution for 2016/22")|[**23**](https://adventofcode.com/2016/day/23) [<img height=12 src=".assets/py.svg">](Python/2016/23.py "Python solution for 2016/23")|[**24**](https://adventofcode.com/2016/day/24) [<img height=12 src=".assets/py.svg">](Python/2016/24.py "Python solution for 2016/24")|[**25**](https://adventofcode.com/2016/day/25) [<img height=12 src=".assets/py.svg">](Python/2016/25.py "Python solution for 2016/25")|
|
||||
|26|27|28|29|30|31||
|
||||
|
||||
## [2015](https://adventofcode.com/2015) ([<img height=18 src=".assets/py.svg"> Python](Python/2015): 25/25 | [<img height=18 src=".assets/rs.svg"> Rust](Rust/2015): 6/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 3/25 | [<img height=18 src=".assets/nix.svg"> Nix](Nix/2015): 1/25)
|
||||
## [2015](https://adventofcode.com/2015) ([<img height=18 src=".assets/py.svg"> Python](Python/2015): 25/25 | [<img height=18 src=".assets/rs.svg"> Rust](Rust/2015): 6/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 3/25 | [<img height=18 src=".assets/nix.svg"> Nix](Nix/2015): 1/25 | [<img height=18 src=".assets/nu.svg"> Nu](Nu/2015): 1/25)
|
||||
|Mo|Tu|We|Th|Fr|Sa|Su|
|
||||
|-|-|-|-|-|-|-|
|
||||
||[**1**](https://adventofcode.com/2015/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2015/01.rs "Rust solution for 2015/01") [<img height=12 src=".assets/py.svg">](Python/2015/01.py "Python solution for 2015/01") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgotwqwuPUAoCuKKgygrMeKKl8KvMVwrKS8rCg== "Uiua solution for 2015/01") [<img height=12 src=".assets/nix.svg">](Nix/2015/01.nix "Nix solution for 2015/01")|[**2**](https://adventofcode.com/2015/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2015/02.rs "Rust solution for 2015/02") [<img height=12 src=".assets/py.svg">](Python/2015/02.py "Python solution for 2015/02") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqc4ouV4omgQHguKeKJoEBcbi4KCuKIqSgvKyspIOKJoeKKgygvw5d8w5cyLeKKgy_ihqUvK3zDt-KKgy_ihqUvw5d8w5cyLyviiaEvw5fil6sy4oavWzRdKQo= "Uiua solution for 2015/02")|[**3**](https://adventofcode.com/2015/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2015/03.rs "Rust solution for 2015/03") [<img height=12 src=".assets/py.svg">](Python/2015/03.py "Python solution for 2015/03") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgrilr3iiIosInZePD4iCuKItSjiioLiioMoLeKIqT1AXixAdikoLeKIqT1APCxAPikpCgriiKko4qe74oqdKSDiioMo4oqC4oipKFwr4oqCMF8wKSDiiKko4o2J4oqiKeKHjC7ijYnihq_iioI6Ml8yw7cy4qe7LikgKFwr4oqCMF8wKQo= "Uiua solution for 2015/03")|[**4**](https://adventofcode.com/2015/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2015/04.rs "Rust solution for 2015/04") [<img height=12 src=".assets/py.svg">](Python/2015/04.py "Python solution for 2015/04")|[**5**](https://adventofcode.com/2015/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2015/05.rs "Rust solution for 2015/05") [<img height=12 src=".assets/py.svg">](Python/2015/05.py "Python solution for 2015/05")|[**6**](https://adventofcode.com/2015/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2015/06.rs "Rust solution for 2015/06") [<img height=12 src=".assets/py.svg">](Python/2015/06.py "Python solution for 2015/06")|
|
||||
||[**1**](https://adventofcode.com/2015/day/1) [<img height=12 src=".assets/rs.svg">](Rust/2015/01.rs "Rust solution for 2015/01") [<img height=12 src=".assets/py.svg">](Python/2015/01.py "Python solution for 2015/01") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgotwqwuPUAoCuKKgygrMeKKl8KvMVwrKS8rCg== "Uiua solution for 2015/01") [<img height=12 src=".assets/nix.svg">](Nix/2015/01.nix "Nix solution for 2015/01") [<img height=12 src=".assets/nu.svg">](Nu/2015/01.nu "Nu solution for 2015/01")|[**2**](https://adventofcode.com/2015/day/2) [<img height=12 src=".assets/rs.svg">](Rust/2015/02.rs "Rust solution for 2015/02") [<img height=12 src=".assets/py.svg">](Python/2015/02.py "Python solution for 2015/02") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqc4ouV4omgQHguKeKJoEBcbi4KCuKIqSgvKyspIOKJoeKKgygvw5d8w5cyLeKKgy_ihqUvK3zDt-KKgy_ihqUvw5d8w5cyLyviiaEvw5fil6sy4oavWzRdKQo= "Uiua solution for 2015/02")|[**3**](https://adventofcode.com/2015/day/3) [<img height=12 src=".assets/rs.svg">](Rust/2015/03.rs "Rust solution for 2015/03") [<img height=12 src=".assets/py.svg">](Python/2015/03.py "Python solution for 2015/03") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgrilr3iiIosInZePD4iCuKItSjiioLiioMoLeKIqT1AXixAdikoLeKIqT1APCxAPikpCgriiKko4qe74oqdKSDiioMo4oqC4oipKFwr4oqCMF8wKSDiiKko4o2J4oqiKeKHjC7ijYnihq_iioI6Ml8yw7cy4qe7LikgKFwr4oqCMF8wKQo= "Uiua solution for 2015/03")|[**4**](https://adventofcode.com/2015/day/4) [<img height=12 src=".assets/rs.svg">](Rust/2015/04.rs "Rust solution for 2015/04") [<img height=12 src=".assets/py.svg">](Python/2015/04.py "Python solution for 2015/04")|[**5**](https://adventofcode.com/2015/day/5) [<img height=12 src=".assets/rs.svg">](Rust/2015/05.rs "Rust solution for 2015/05") [<img height=12 src=".assets/py.svg">](Python/2015/05.py "Python solution for 2015/05")|[**6**](https://adventofcode.com/2015/day/6) [<img height=12 src=".assets/rs.svg">](Rust/2015/06.rs "Rust solution for 2015/06") [<img height=12 src=".assets/py.svg">](Python/2015/06.py "Python solution for 2015/06")|
|
||||
|[**7**](https://adventofcode.com/2015/day/7) [<img height=12 src=".assets/py.svg">](Python/2015/07.py "Python solution for 2015/07")|[**8**](https://adventofcode.com/2015/day/8) [<img height=12 src=".assets/py.svg">](Python/2015/08.py "Python solution for 2015/08")|[**9**](https://adventofcode.com/2015/day/9) [<img height=12 src=".assets/py.svg">](Python/2015/09.py "Python solution for 2015/09")|[**10**](https://adventofcode.com/2015/day/10) [<img height=12 src=".assets/py.svg">](Python/2015/10.py "Python solution for 2015/10")|[**11**](https://adventofcode.com/2015/day/11) [<img height=12 src=".assets/py.svg">](Python/2015/11.py "Python solution for 2015/11")|[**12**](https://adventofcode.com/2015/day/12) [<img height=12 src=".assets/py.svg">](Python/2015/12.py "Python solution for 2015/12")|[**13**](https://adventofcode.com/2015/day/13) [<img height=12 src=".assets/py.svg">](Python/2015/13.py "Python solution for 2015/13")|
|
||||
|[**14**](https://adventofcode.com/2015/day/14) [<img height=12 src=".assets/py.svg">](Python/2015/14.py "Python solution for 2015/14")|[**15**](https://adventofcode.com/2015/day/15) [<img height=12 src=".assets/py.svg">](Python/2015/15.py "Python solution for 2015/15")|[**16**](https://adventofcode.com/2015/day/16) [<img height=12 src=".assets/py.svg">](Python/2015/16.py "Python solution for 2015/16")|[**17**](https://adventofcode.com/2015/day/17) [<img height=12 src=".assets/py.svg">](Python/2015/17.py "Python solution for 2015/17")|[**18**](https://adventofcode.com/2015/day/18) [<img height=12 src=".assets/py.svg">](Python/2015/18.py "Python solution for 2015/18")|[**19**](https://adventofcode.com/2015/day/19) [<img height=12 src=".assets/py.svg">](Python/2015/19.py "Python solution for 2015/19")|[**20**](https://adventofcode.com/2015/day/20) [<img height=12 src=".assets/py.svg">](Python/2015/20.py "Python solution for 2015/20")|
|
||||
|[**21**](https://adventofcode.com/2015/day/21) [<img height=12 src=".assets/py.svg">](Python/2015/21.py "Python solution for 2015/21")|[**22**](https://adventofcode.com/2015/day/22) [<img height=12 src=".assets/py.svg">](Python/2015/22.py "Python solution for 2015/22")|[**23**](https://adventofcode.com/2015/day/23) [<img height=12 src=".assets/py.svg">](Python/2015/23.py "Python solution for 2015/23")|[**24**](https://adventofcode.com/2015/day/24) [<img height=12 src=".assets/py.svg">](Python/2015/24.py "Python solution for 2015/24")|[**25**](https://adventofcode.com/2015/day/25) [<img height=12 src=".assets/py.svg">](Python/2015/25.py "Python solution for 2015/25")|26|27|
|
||||
|
|
|
@ -145,6 +145,9 @@
|
|||
|
||||
# Uiua
|
||||
uiua
|
||||
|
||||
# Nushell
|
||||
nushell
|
||||
];
|
||||
PYTHONPATH = ".";
|
||||
LIBCLANG_PATH = with pkgs; lib.makeLibraryPath [llvmPackages.clang-unwrapped.lib];
|
||||
|
|
|
@ -3,8 +3,8 @@ from collections import Counter
|
|||
from datetime import date
|
||||
from pathlib import Path
|
||||
|
||||
names = {"rs": "Rust", "hs": "Haskell", "py": "Python", "apl": "APL", "ua": "Uiua", "nix": "Nix"}
|
||||
exts = {"rs": [".rs"], "hs": [".hs"], "py": [".py"], "apl": [".apl"], "ua": [".ua"], "nix": [".nix"]}
|
||||
names = {"rs": "Rust", "hs": "Haskell", "py": "Python", "apl": "APL", "ua": "Uiua", "nix": "Nix", "nu": "Nu"}
|
||||
exts = {"rs": [".rs"], "hs": [".hs"], "py": [".py"], "apl": [".apl"], "ua": [".ua"], "nix": [".nix"], "nu": [".nu"]}
|
||||
|
||||
logos = {k.name.split(".")[0]: str(k) for k in Path(".assets").iterdir()}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue