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
[–] 2 points 9 months ago (1 child)

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β‚‚)
  • source
  • hideshow 1 child comment
  • [–] 2 points 9 months 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.

  • source
  • parent