this post was submitted on 01 Dec 2025
47 points (100.0% liked)

Advent Of Code

1154 readers
39 users here now

An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Everybody Codes is another collection of programming puzzles with seasonal events.

EC 2025

AoC 2025

Solution Threads

M T W T F S S
1 2 3 4 5 6 7
8 9 10 11 12

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 2 years ago
MODERATORS
 

Day 1: Secret Entrance

Megathread guidelines

  • Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
  • You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL

FAQ

you are viewing a single comment's thread
view the rest of the comments
[–] mykl@lemmy.world 7 points 2 days ago (1 children)

Uiua

Today's lesson: Never think that scanning the first 100 lines of input will give you a good understanding of it.

Part 2 is really messy and could probably be much simpler, but I couldn't get the logic straight in my head otherwise.

"L68 L30 R48 L5 R60 L55 L1 L99 R14 L82"
βŠœβ‹•βŠΈβ‰ @\sβˆ§βœβŠ‘β‹…@Β―βŠšβŠΈβŒ•"L"βˆ§βœβŠ‘β‹…@+βŠšβŠΈβŒ•"R"
P₁ ← ⧻⊚=0\(β—Ώ100+)βŠ‚50
P ← (
  βŠƒ(-Γ—100Γ—|/+)⌊÷100⌡⟜(⊸±) # Count and remove all over-rotations
  β‰βŠŸβ†˜Β―1⊸(\(β—Ώ100+)βŠ‚50)     # Take all positions and next moves.
  β–½βŠΈβ‰‘(β‰ 0⊒)                # Ignore any starting from zero
  +/+β†₯βŠƒ(<0|>100)≑/+       # Sum the pairs, check for passing zero.
)
Pβ‚‚ ← +βŠƒP P₁
βŠƒ(P₁|Pβ‚‚)
[–] mykl@lemmy.world 4 points 2 days ago

Just had a look at the Uiua Discord, and Part 2 can be simplified a little...

"L68 L30 R48 L5 R60 L55 L1 L99 R14 L82"
βŠœβ‹•βŠΈβ‰ @\sβˆ§βœβŠ‘β‹…@Β―βŠšβŠΈβŒ•"L"βˆ§βœβŠ‘β‹…@+βŠšβŠΈβŒ•"R"
P₁ ← ⧻⊚=0\(β—Ώ100+)βŠ‚50
Pβ‚‚ ← /+=0β—Ώ100\+β–½βŒ΅βŸœΒ±βŠ‚50
βŠƒP₁ Pβ‚‚

Sometimes I could just cry.