Boojum







Boojum

Gives 100 Reddit Coins and a week of r/lounge access and ad-free browsing.

Gives 700 Reddit Coins and a month of r/lounge access and ad-free browsing.

When you come across a feel-good thing.




Boojum

Gives 100 Reddit Coins and a week of r/lounge access and ad-free browsing.


















  1. Yes. It makes more sense if you finish all the days.

  2. One that I like to do is to keep my Part 1 and Part 2 solutions in separate source files. I'll do a Save As... to begin the second part as soon as I've solved the first.

  3. First of, you can use complex numbers to get 2d coordinates into one number. If your language of choice has native support or a good standard library there are a number of advantages. You can add and subtract them without bothering to pick them apart. If you have a direction you can set i to be upwards 1 to be right, -i to be down and -1 to be left. Then you can multiply by i for counter clockwise rotation and with -i for clockwise rotation. The only inconvenience is that it will usually involve two float coordinates and you will often need to convert it to integers at some point. But floats will be accurate for integer conversion up to rather large numbers so usually you do not need to worry about that.

  4. The range for exactly representable integers is -224 to 224 for single precision and -253 to 253 for double precision. And many languages, like JavaScript just use doubles like that instead of having a distinct integer type. So yes, it usually works okay in practice.

  5. On the mythology note, I was amused that the bumper for the production company, TSG, was of Odysseus drawing his bow and shooting the arrow through the holes of the axe heads.

  6. Poltergeist. They showed it at my middle school on a slow, end-of-semester/just-before-holidays day. Even now, I still don't like to sleep with a closet door open.

  7. There's also a couple of pipe characters sprinkled in.

  8. Categorization is great. I've wanted to do something like it for years but never bothered to. And not just categories but also tags (for the problem and for the solution, e.g. algorithms).

  9. Thanks! And yep, quickly swiping code from previous a year's solution was definitely a selfish part of my motivation. I've got a snippets file, but wanted to be able to quickly find full solutions too.

  10. Because reddit lock (archive) posts, I think after 6 months, you will eventually not be able to edit this nor add comment to this. You should host this on a static site, given that you're using markdown here, it should be easy to put this all on github or github page. People could even do PR there!

  11. I've got a script saved with everything that I need to regenerate this post. My plan is to post a new thread in about a year, updated with data from AoC 2022.

  12. Besides cppreference.com that was already mentioned (and which you'll use at all levels), some other potential resources are:

  13. Suggestion for clarification: On the question about participation in previous years, does "later" mean later that year or later at any time. For context, Dec. 2021 was my first time doing AoC, but then, having been bitten by the bug, I went back and did all the other years over the course of the past year. (Woot! I joined the 350 club a couple of weeks ago!) Would that count as later for participation here? Or does later mean over the following year between Dec. and the next AoC?

  14. i've seen emacs around and i was thinking about using it, i've heard it has a bit of a steep learning curve but once you get to grips it's pretty amazing. i'm probably gonna have a look into it after work today, thank you for your answer!

  15. When I first started with Emacs on Unix, ~25 year ago, I used it vanilla with the menus and toolbars and it wasn't much harder to figure out and use than Notepad or a basic IDE editor on windows. A lot of Emacs users recommend turning off the menu and toolbar, but exploring them as a beginner really helped to give me some idea of what it can do.

  16. How do you eat an elephant? One bite at a time.

  17. Think of this analogy. You have a responsive webpage with 4 columns. In desktop view, those 4 columns, you can read left to right. Resize, it view becomes one column. column 2,3,4 will shift down.

  18. I would refrain from making any assumptions and just check the assembly. Until proven otherwise, an if is an if and both will result in branching.

  19. That's pretty cool that in the first assembly listing it recognizes the mixing expression at the end of no_if_fun() and optimizes it into a cmov.

  20. Always. It's reflex at this point. (And I've only driven automatic, so it's not a manual/automatic thing either.)

  21. Veterans usually get preference points on civil service exams for police/fire/Ems.

  22. At Amazon, ex-military (any country) is also considered a plus in terms of showing logistics experience.

  23. A camera model that let you plug in measured physical values off of an engineering data spec sheet?

  24. Last week I told someone after they asked what I do that I’m a programmer. She said oh do you do web development? Excited me said yes!, primarily. She then told me about how she used to do web development when she was a kid for her blog.

  25. Similarly for me, I haven't touched webdev since the days of LAMP. If you asked me to design a system involving load balancers, sharded DBs, replication, REST, two-phase commits, and such, I'd be totally lost at sea. I find that sort of stuff just makes my eyes glaze over.

  26. Only 813 people in the 350 star club? I'm surprised it didn't grow more since the end of the last event.

  27. I'm at 300 stars right now and I've been saving 2020 for a warmup in a bit over a month. :-)

  28. So, if I were on the interview I’m not sure I’d ask. I’d probably notice, and if there was nothing else to talk about it might come up.

  29. A few other reasons that I've seen friends do it: spending more time with family, focusing on personal coding projects, upgrading their house, and tending to some health issues.

  30. Base "negative 2"? That's interesting. I think you'd have to go back to the definition of a base. If your base is X, the ones place is X0, the "tens" place is X1, and so on. Add all the values together and that's the number you've represented.

  31. Yes, the name for that number system is "negabinary" if you want to look it up. There's a 1's place, a -2's place, a 4's place, a -8's place and so forth. All numbers are still written with 0 and 1 digits as in binary, but it lets you express negative numbers without an explicit sign bit or needing a particular word size as in one's complement or two's complement.

  32. I looked at that first one, and my first impulse is to use regex substitution. Build an appropriate regex with the given number, and run the regex until it comes back with no matches.

  33. I think it could be done in a single O(n) pass with a stack of letter-count pairs. If the next letter is different from the top of the stack, push it with a count of 1. Otherwise, increment the count, and pop it if that makes the count k. At the end, the stack from bottom to top will have the run-length encoded solution so expand that to a string.

  34. For comments or other internal things? Meh, whatever as long as it's correct.

  35. Usually family style here. The exception is when serving meats to preferred temps for everyone. Family style allows each person to take the amount they believe they'll consume which cuts down on waste. It also allows for second helpings of different things without anyone having to leave the table.

  36. Similarly, the exception in my family tends to be for made-to-order things like homemade personal pizzas or calzones. Each person will be served their custom one on their plate and then take it over to the table.

  37. Right? I’ve always lived by the philosophy (not from a legal perspective, just a personal one) that having the right of way doesn’t matter if you’re a pedestrian. Blinking out “but I had right of way” like Monsieur Noirtier is not a victory in my book.

  38. Here lies the body of Mike O'Day, / Who died maintaining his right of way. / His right was clear, his will was strong -- / But he's just as dead as if he'd been wrong!

Leave a Reply

Your email address will not be published. Required fields are marked *