Skip to content

Commit

Permalink
Uiua/2015/04: add solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Defelo committed Dec 17, 2024
1 parent 142f4b7 commit 6deda94
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,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): 7/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 5/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)
## [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): 7/25 | [<img height=18 src=".assets/ua.png"> Uiua](Uiua/2015): 6/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") [<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_ihqUvw5d8w5cyLyvip4jDl-KGr1s0XSkK "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=JnNjCgriipc64oqZ4pa9OuKXoeKIiiI8Xj52Igriio_iiplb4peh4oipwq_iirjih4zih6EyXQoK4oqDKOKkuDHihq_iiJ5fMl8yfMKkKQriiKko4qe74pe04oqCMF8wL-KKguKJoVwrKQo= "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") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipzilqHiiaBAXG4uCgpBIOKGkCAvw5db4oqDKOKJpTMvK-KIiiJhZWlvdSJ8L-KGpeKniD18wqwv4oal4pmt4omh4oyVImFiIl8iY2QiXyJwcSJfInh5IsKkKV0KQiDihpAgw5fiioMo4omlMi_ihqXima3iiaHiprfip4jiiJgy4p-cwqR8L-KGpT3iioPiiqLiiqPijYnip4jiiJgzKQoK4oipLyviiaHil4fiioNCIEEK "Uiua 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") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqZW-KIqeKIqeKLlV0g4o2jKAogICAg4omNIm9uIsKwJCJ0dXJuIF8gXyxfIHRocm91Z2ggXyxfIgogIHwgMsKwJCJ0b2dnbGUgXyxfIHRocm91Z2ggXyxfIikKKeKJoEBcbi4KCuKKmeKKmSjihq9bLjEwMDBdMCkKClNvbHZlISDihpAgLyvima3iiKco4o2c4oqhKF4wOikg4o2c4o2c4o2JLSjima3igoLih6EpIOKKmSgrMSniiKniip_CsFviipniipniipniiJhd4oqZOjopCuKKg1NvbHZlIeKorCjihqUwLTF8KzF8KzIpIFNvbHZlIeKorCjihqcwfOKGpTF8wqwpCg== "Uiua 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_ihqUvw5d8w5cyLyvip4jDl-KGr1s0XSkK "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=JnNjCgriipc64oqZ4pa9OuKXoeKIiiI8Xj52Igriio_iiplb4peh4oipwq_iirjih4zih6EyXQoK4oqDKOKkuDHihq_iiJ5fMl8yfMKkKQriiKko4qe74pe04oqCMF8wL-KKguKJoVwrKQo= "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") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=IyBFeHBlcmltZW50YWwhCgomc2MKCuKWveKKuOKJoEBcbgoKfiAiLi4vdXRpbHMvbGliLnVhIiB-IE1E4oKFCgpaZXJvZXMg4oaQIOKMisO3NC8rXOKGp8Ks4pmt4omh4oeM4ouvTUTigoUkIl9fIjoKTWluZSAgIOKGkCDii4Xiipnil4zijaIo4oqZK-KCgXw84oqZWmVyb2VzKQoKTWluZSA2IOKfnDriirhNaW5lIDUgMQo= "Uiua 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") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipzilqHiiaBAXG4uCgpBIOKGkCAvw5db4oqDKOKJpTMvK-KIiiJhZWlvdSJ8L-KGpeKniD18wqwv4oal4pmt4omh4oyVImFiIl8iY2QiXyJwcSJfInh5IsKkKV0KQiDihpAgw5fiioMo4omlMi_ihqXima3iiaHiprfip4jiiJgy4p-cwqR8L-KGpT3iioPiiqLiiqPijYnip4jiiJgzKQoK4oipLyviiaHil4fiioNCIEEK "Uiua 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") [<img height=12 src=".assets/ua.png">](https://uiua.org/pad?src=JnNjCgriipwo4oqZW-KIqeKIqeKLlV0g4o2jKAogICAg4omNIm9uIsKwJCJ0dXJuIF8gXyxfIHRocm91Z2ggXyxfIgogIHwgMsKwJCJ0b2dnbGUgXyxfIHRocm91Z2ggXyxfIikKKeKJoEBcbi4KCuKKmeKKmSjihq9bLjEwMDBdMCkKClNvbHZlISDihpAgLyvima3iiKco4o2c4oqhKF4wOikg4o2c4o2c4o2JLSjima3igoLih6EpIOKKmSgrMSniiKniip_CsFviipniipniipniiJhd4oqZOjopCuKKg1NvbHZlIeKorCjihqUwLTF8KzF8KzIpIFNvbHZlIeKorCjihqcwfOKGpTF8wqwpCg== "Uiua solution for 2015/06")|
|[**7**](https://adventofcode.com/2015/day/7) [<img height=12 src=".assets/rs.svg">](Rust/2015/07.rs "Rust solution for 2015/07") [<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|
Expand Down
12 changes: 12 additions & 0 deletions Uiua/2015/04.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Experimental!

&fras ⊣ &args

▽⊸≠@\n

~ "../utils/lib.ua" ~ MD₅

Zeroes ← ⌊÷4/+\↧¬♭≡⇌⋯MD₅$"__":
Mine ← ⋅⊙◌⍢(⊙+₁|<⊙Zeroes)

Mine 6 ⟜:⊸Mine 5 1
1 change: 1 addition & 0 deletions Uiua/utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libutils.so
77 changes: 77 additions & 0 deletions Uiua/utils/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Uiua/utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "utils"
version = "0.1.0"
edition = "2024"

[lib]
crate-type = ["cdylib"]

[dependencies]
md-5 = "0.10.6"
7 changes: 7 additions & 0 deletions Uiua/utils/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -ex

target=$(cargo metadata --format-version=1 | jq -r .target_directory)
cargo build -r
cp "$target/release/libutils.so" .
5 changes: 5 additions & 0 deletions Uiua/utils/lib.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Experimental!

Lib ↚ &ffi⊂□"./utils/libutils.so"

MD₅ ← Lib {$"{_}"/⊂↯16"unsigned char;" "md5" "const unsigned char:1" "unsigned long"} □₁
12 changes: 12 additions & 0 deletions Uiua/utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use std::slice;

use md5::{Digest, Md5};

#[repr(C)]
pub struct Md5Digest([u8; 16]);

#[unsafe(no_mangle)]
pub unsafe extern "C" fn md5(data: *const u8, len: usize) -> Md5Digest {
let data = unsafe { slice::from_raw_parts(data, len) };
Md5Digest(*Md5::new().chain_update(data).finalize().as_ref())
}

0 comments on commit 6deda94

Please sign in to comment.