Skip to content

Commit

Permalink
2024 08 (uiua)
Browse files Browse the repository at this point in the history
  • Loading branch information
memark committed Dec 17, 2024
1 parent 51df220 commit 10d19fe
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 2024/day-08/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
......#....#
...#....0...
....#0....#.
..#....0....
....0....#..
.#....A.....
...#........
#......#....
........A...
.........A..
..........#.
..........#.
50 changes: 50 additions & 0 deletions 2024/day-08/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
...s..............................................
...................w......K.......t...............
........s.........................................
.......s......w...............1...................
.........w5.......................................
.......................t.F........................
..................................................
F................................1...........d....
.........................5......................K.
............5.................R..............KZ...
....F.....q.........w..............1.....t........
............8.......I.............................
..........8.................t....................K
...........8.................5.....Z..............
.........q..............................Z...d..U..
...................Y.q...R........................
....................E.....z...............y.......
..........................................U.......
.....F.................................k........S.
............q...................d.................
.................................R................
..x....................................U.........y
.......x.........................E..M...U..d......
......z.......X............................4......
...............I....m....M......R............y....
.......z...................................k..e...
..f..z.......................................e....
...f.I..........7..u..........M................D..
.......X..I.......x.................k.............
.........X.......7....................4.......S...
....................u9...T.....3.Z....o..........6
........f.......D..3....u..................S......
...W...0.........................................D
.....................T................E.......m...
...8....Y............f........T4..................
......Y...........................................
....0.............3...............................
....................3.T.....................k.....
.......................u..............6...........
...........................6..........9........e..
..................4....7.............o..........D.
.................................M...E..o.........
...i.................O...........................Q
.....0.i.....................................m.2..
.......Y.r........7..............S..O..2.......m..
.....r......0.............O.......................
..................................Q...............
........................6................o......Q.
..W...r.................................9.........
.W.........................O........2.............
61 changes: 61 additions & 0 deletions 2024/day-08/main.ua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# https://adventofcode.com/2024/day/8

# uiua 0.14.0-dev.7
# Experimental!

# ? matrix
🔤 ← $chars ▽⊸≠@. ▽⊸≠@# ◴/⊂

# ? char matrix
🗺 ← $coords ⊚=

# ? antennas
👥 ← $pairs ⧅<2

# ? pair
〰️ ← $antinodes /⊂ ≡⍜°⊟⊃(+⊸-:|+⊸-)

# ? coord coordmax
🏰 ← $isinside ×⊃(/×<:|/×≥₀)
┌─╴🧪
⍤⤙≍ 0 🏰 ¯1_¯1 10_10
⍤⤙≍ 1 🏰 5_5 10_10
⍤⤙≍ 1 🏰 0_0 10_10
⍤⤙≍ 0 🏰 10_10 10_10
└─╴

🐪 ← (
⊜∘⊸≠@\n
⊃(/◇⊂≡(□〰️👥🗺)⊙¤⊸🔤|△)
▽⤚≡🏰⊙¤
⧻◴
)
┌─╴🧪
⍤⤙≍ 14 🐪 &fras"example.txt"
⍤⤙≍ 240 🐪 &fras"input.txt"
└─╴

🔧 ← ⍜▽⋅∞⊸=¯∞

# ? antennapair coordmax
➰ ← (
⊚↯:1:
⊸(:¤):
≡(/=🔧/÷-¤)
)
┌─╴🧪
⍤⤙≍ [0_0 1_3 2_6 3_9] ➰ [0_0 1_3] 10_10
⍤⤙≍ [0_11 1_8 2_5 3_2] ➰ [1_8 2_5] 12_12
└─╴

🐫 ← (
⊜∘⊸≠@\n
⊃(/◇⊂ ≡(□👥🗺)⊙¤⊸🔤|△)
/◇⊂≡(□➰)⊙¤
⧻◴
)
┌─╴🧪
⍤⤙≍ 34 🐫 &fras"example.txt"
⍤⤙≍ 955 🐫 &fras"input.txt"
└─╴

0 comments on commit 10d19fe

Please sign in to comment.