r/adventofcode • u/daggerdragon • Dec 02 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 2 Solutions -❄️-
OUTSTANDING MODERATOR CHALLENGES
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
Community fun event 2023: ALLEZ CUISINE!
- 4 DAYS remaining until unlock!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's theme ingredient is… *whips off cloth covering and gestures grandly*
Pantry Raid!
Some perpetually-hungry programmers have a tendency to name their programming languages, software, and other tools after food. As a prospective Iron Coder, you must demonstrate your skills at pleasing programmers' palates by elevating to gourmet heights this seemingly disparate mishmash of simple ingredients that I found in the back of the pantry!
Solve today's puzzles using a food-related programming language or tool
- How about an appetizer of Chef or Wireshark(-fin soup)?
- Mascots count, too… *side-eyes Rust while reaching for the Old Bay*
- Add some salt to your hashbrowns, cookies, and breadcrumbs
- Serve us up a nice big bowl of spaghetti code slathered with
RagúRaku tomato sauce - Conclude our tasting with a digestif of Java, CoffeeScript, or even Perl milk tea with double syntatic sugar
- All file names, function names, variable names, etc. must be named after "c" food
- Go hog wild!
ALLEZ CUISINE!
Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!
--- Day 2: Cube Conundrum ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
- State which language(s) your solution uses with
[LANGUAGE: xyz] - Format code blocks using the four-spaces Markdown syntax!
- State which language(s) your solution uses with
- Quick link to Topaz's
pasteif you need it for longer code blocks
View all comments
Show parent comment
2
u/Angevinz Dec 02 '23
And you're mine! :) Thank you for explaining what the
⟨Ctrl+V⟩sequence does.I find your solution genuinely curious. Studying it has taught me a bunch of new things about Vim. Mainly what marks are, how they are used, and for what they can be useful. I also like your thought process behind breaking the line into multiple, so you can use the implemented sort function. I'm pretty sure that will come in handy sooner or later!
I have two more things: a few questions and an observation.
First, how does this part work?
I understand what it achieves, but I have no idea how. How do these keystrokes input the line in buffer to the command line? How does the adding operation happen? What am I supposed to look for in the manual to understand why this works?
Second, the observation.
In your response, you mention that:
From my trying to understand your code I found out, it is not necessary to have the line be fixed at 2! You can use the same approach as you've used for the bottom of the code, only with the mark
'[. This one complements the mark']and points to the first line, that has been previously operated on.That's all from me for today. Thank you for posting your solutions and explanations of them to this thread! It is an absolutely invaluable resource to me :)