|
And now, for the grand finale... Day 25! [ goto ] Think you know code? Want internet points on a leaderboard? Check out Advent of Code! quote:Advent of Code is a series of small programming puzzles for a variety of skill levels. They are self-contained and are just as appropriate for an expert who wants to stay sharp as they are for a beginner who is just learning to code. Each puzzle calls upon different skills and has two parts that build on a theme. My buddy who created this crazy thing is equal parts genius and madman, and now he's sharing his insanity with you. Whether you're looking for an excuse to learn a new language or brush up on a rarely-used language (or stick to your tried-and-true), the Advent of Code will give you a run for your money. So, let's get this Advent party started. Every midnight I'll (try to remember to) post the daily challenge summary. It's up to you to make 'em go! --- Day 1: Not Quite Lisp --- quote:Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect fifty stars by December 25th. daggerdragon fucked around with this message at 06:03 on Dec 25, 2015 |
# ? Dec 2, 2015 07:04 |
|
|
# ? May 13, 2024 09:46 |
|
--- Day 2: I Was Told There Would Be No Math ---quote:The elves are running low on wrapping paper, and so they need to submit an order for more. They have a list of the dimensions (length l, width w, and height h) of each present, and only want to order exactly as much as they need.
|
# ? Dec 2, 2015 07:04 |
|
I'm on it, elves!
|
# ? Dec 2, 2015 18:38 |
|
--- Day 3: Perfectly Spherical Houses in a Vacuum ---quote:Santa is delivering presents to an infinite two-dimensional grid of houses. [...] However, the elf back at the north pole has had a little too much eggnog, and so his directions are a little off, and Santa ends up visiting some houses more than once. How many houses receive at least one present?
|
# ? Dec 3, 2015 06:04 |
|
Hey, I went to college with this guy, that's neat. Gonna give it a try!
|
# ? Dec 4, 2015 01:50 |
|
Ooh, I'm always up for some coding challenges.
|
# ? Dec 4, 2015 15:42 |
|
Oh good, the forums are finally back up. Here's day 4's belated post. --- Day 4: The Ideal Stocking Stuffer --- quote:Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the economically forward-thinking little girls and boys.
|
# ? Dec 4, 2015 17:30 |
|
A bunch of people are putting up visualizations of the Day 3 answer. Spoilers obviously. http://snk.digibase.ca/advent3.html It's pretty neat looking.
|
# ? Dec 4, 2015 20:09 |
|
On it! I'm always indecisive about whether I want to use these as opportunities to try to work with a new programming language or not. Usually I start with trying to write it in [Flavor Of The Week], bang my head on the desk for an hour, then give up and write it in Python in 5 minutes.
|
# ? Dec 4, 2015 22:17 |
|
I had fun doing all four days in node. They're neat little simple puzzles. Love that visualization thanks for posting Iron Doge.
|
# ? Dec 4, 2015 23:37 |
|
chutwig posted:On it! I'm always indecisive about whether I want to use these as opportunities to try to work with a new programming language or not. Usually I start with trying to write it in [Flavor Of The Week], bang my head on the desk for an hour, then give up and write it in Python in 5 minutes. Yeah, I enjoy little puzzles like these as I try to learn a new language. Currently fiddling with Perl 6, and just got my first two stars.
|
# ? Dec 5, 2015 01:18 |
|
This Day 4 challenge, I have the feeling that I should have done it by actually knowing how MD5 works (very well) and then figuring out what kind of message would produce what kind of output. But then I just brute forced it, parallelized it and called it a day. I feel dirty. Then again, it is the simplest solution, but ...
|
# ? Dec 5, 2015 05:55 |
|
--- Day 5: Doesn't He Have Intern-Elves For This? ---quote:Santa needs help figuring out which strings in his text file are naughty or nice.
|
# ? Dec 5, 2015 06:05 |
|
Volguus posted:This Day 4 challenge, I have the feeling that I should have done it by actually knowing how MD5 works (very well) and then figuring out what kind of message would produce what kind of output. But then I just brute forced it, parallelized it and called it a day. I feel dirty. Then again, it is the simplest solution, but ... I didn't feel that dirty doing it that way, my slow rear end perl script took less than a second to do part 1 and about 3 seconds to do part 2. Only crashed my terminal once when I called the script with no input and triggered a warning on every iteration... This string parsing challenge was pretty simple to do with perls regex engine as well. Is there any way to change what link is associated with your name to something other than the default for the login service you used? I used Google as my id provider but I'd rather link my github profile than my g+ profile if I end up making it onto the leaderboard.
|
# ? Dec 5, 2015 13:58 |
|
Day 5: REGULAR EXPRESSIONS
|
# ? Dec 5, 2015 15:14 |
|
Ephphatha posted:I didn't feel that dirty doing it that way, my slow rear end perl script took less than a second to do part 1 and about 3 seconds to do part 2. Only crashed my terminal once when I called the script with no input and triggered a warning on every iteration... This string parsing challenge was pretty simple to do with perls regex engine as well. My buddy is not willing to screw with the logins while the Advent is running since we're trying to make sure that the server (and code) stay stable for the entire duration of the Advent. However, you can create another account using your Github profile, re-use your existing code (you did save it, right?) to solve up to today's puzzle, and only use that one to solve future puzzles from now on if you want to try to make it on the leaderboard.
|
# ? Dec 5, 2015 23:25 |
|
I've looked at it every which way but I'm clueless on how to go about solving Day 4. I have a basic gist of hexadecimals but I'm not understanding MD5 hashes and what is needed to solve the problem. Anyone able to break the problem down in a different way? *I'm trying to solve this using Perl 6. Hughmoris fucked around with this message at 01:51 on Dec 6, 2015 |
# ? Dec 6, 2015 01:49 |
|
Hughmoris posted:I've looked at it every which way but I'm clueless on how to go about solving Day 4. Here is how I solved it in Python: https://github.com/erhudy/adventofcode-solutions/blob/master/problem4.py Basically you need to concatenate the given key to the string form of a monotonically increasing integer, hash it with whatever MD5 function Perl 6 provides that will give you back a string, and check the start of the string for "00000". If not, increment the integer and try again. E.g., if your key is "abcdef", you would MD5 hash "abcdef0", check the hex output for a start of "00000", then try "abcdef1", "abcdef2", and so forth. Googling around, it looks like actually doing the hashing in Perl 6 might be a pain. You can shell out and use md5/md5sum (just be sure to strip newlines): code:
code:
chutwig fucked around with this message at 04:04 on Dec 6, 2015 |
# ? Dec 6, 2015 03:57 |
|
--- Day 6: Probably a Fire Hazard ---quote:Because your neighbors keep defeating you in the holiday house decorating contest year after year, you've decided to deploy one million lights in a 1000x1000 grid.
|
# ? Dec 6, 2015 06:01 |
|
chutwig posted:Here is how I solved it in Python: https://github.com/erhudy/adventofcode-solutions/blob/master/problem4.py Thanks for the tips. I'm going to take another look at it.
|
# ? Dec 6, 2015 17:12 |
|
--- Day 7: Some Assembly Required ---quote:This year, Santa brought little Bobby Tables a set of wires and bitwise logic gates! Unfortunately, little Bobby is a little under the recommended age range, and he needs help assembling the circuit.
|
# ? Dec 7, 2015 06:01 |
|
Well I forced myself to learn regex this weekend, so I suppose I got something of all this. Took this opportunity to mess around with Python as well.
|
# ? Dec 7, 2015 14:44 |
|
Did the first 6 tests in PHP today Will be looking around for other solutions to see how well my code designs are
|
# ? Dec 8, 2015 01:01 |
|
--- Day 8: Matchsticks ---quote:Space on the sleigh is limited this year, and so Santa will be bringing his list as a digital copy. He needs to know how much space it will take up when stored. Santa needs to get a goddamn Kindle or something for that list of his...
|
# ? Dec 8, 2015 06:01 |
|
I've been solving these with Haskell. Mostly it's been going well, but my Day 6 solution was very inefficient because I implemented it with the Data.Array module and couldn't figure out how to only run through the indices that were actually changed with the available functions, so I ended up updating the entire array every time. I probably should've used a mutable 2D array of some sort instead, but my initial solution was barely fast enough to be acceptable so I didn't bother. Day 7 tripped me up repeatedly because I didn't understand the question correctly: - At first I thought a wire would always already have a signal at the time it's used to provide a signal for another wire, mostly because that was the case in the example. Actually looking at the input cleared up that misconception. - Then I for some reason got it into my head that if a wire doesn't have a signal when it's used it should be treated as having the value 0. I pulled this out of thin air, and it was obviously wrong. - At last I realized that you're supposed to go through the list repeatedly until all the signals are turned on (or build some sort of expression tree by going backwards, I guess), so I changed up my algorithm and got a plausible result, but it was still wrong. - Then I spent another half hour or so until I finally realized I had been rotating the bits instead of shifting them. I found Day 8 to be simpler in comparison. I used the very awesome Parsec library to parse the strings and got the right result pretty quickly. Using regex or even just simple string matching would probably be just as easy, but they're not as cool as Parsec.
|
# ? Dec 8, 2015 16:38 |
|
LOOK I AM A TURTLE posted:I found Day 8 to be simpler in comparison. We've noticed that Day 8 was polarizing in that players either immediately understood and knew how to solve it (like you) or had absolutely no clue where to even start. It's fascinating.
|
# ? Dec 9, 2015 04:45 |
|
--- Day 9: All in a Single Night ---quote:Every year, Santa manages to deliver all of his presents in a single night.
|
# ? Dec 9, 2015 06:03 |
|
--- Day 10: Elves Look, Elves Say ---quote:Today, the Elves are playing a game called look-and-say. They take turns making sequences by reading aloud the previous sequence and using that reading as the next sequence. daggerdragon fucked around with this message at 05:59 on Dec 11, 2015 |
# ? Dec 10, 2015 06:03 |
|
daggerdragon posted:(you did save it, right?) Haha, I actually got up to 7 in the Chrome console and just closed it when I was done. Dunno if I feel like attempting it in there, though.
|
# ? Dec 10, 2015 21:42 |
|
--- Day 11: Corporate Policy ---quote:Santa's previous password expired, and he needs help choosing a new one.
|
# ? Dec 11, 2015 06:02 |
|
You ever wrote some code, then in the middle of it went "I'm dumb", except you instead of doing it correctly you just beat it with a hammer and pray for the best?code:
invision fucked around with this message at 12:17 on Dec 11, 2015 |
# ? Dec 11, 2015 11:39 |
|
--- Day 12: JSAbacusFramework.io ---quote:Santa's Accounting-Elves need help balancing the books after a recent order. Unfortunately, their accounting software uses a peculiar storage format. That's where you come in.
|
# ? Dec 12, 2015 06:00 |
|
After I finally gave in and used regexes for a problem, the second part kinda hurt. So I just created a bracket matcher and deleter. Sometimes everything IS a nail.
|
# ? Dec 12, 2015 22:49 |
|
--- Day 13: Knights of the Dinner Table ---quote:In years past, the holiday feast with your family hasn't gone so well. Not everyone gets along! This year, you resolve, will be different. You're going to find the optimal seating arrangement and avoid all those awkward conversations.
|
# ? Dec 13, 2015 06:01 |
|
I pretty much copied my solution from Day 9 for this one, kinda disappointing. I still need to figure out Day 7 though, drat wires.
|
# ? Dec 14, 2015 05:59 |
|
--- Day 14: Reindeer Olympics ---quote:This year is the Reindeer Olympics! Reindeer can fly at high speeds, but must rest occasionally to recover their energy. Santa would like to know which of his reindeer is fastest, and so he has them race.
|
# ? Dec 14, 2015 06:01 |
|
Did the first 3, then looked to see what lay ahead and got to day 7 and checked the input...that fuckin' took the wind out of my sails hahaha. Even the following days seem easy in comparison. After finals this week I'll be knocking more of these out. Thanks for sharing.
|
# ? Dec 14, 2015 08:56 |
|
I spent so much time on 9 to get a recursive thing to work without crapping on me. Turned out sometimes js really fucks with its variables. Nothing a judicious use of var can't fix, but I still don't know where exactly it went wrong. Bah humbug. For 7 I couldn't get my head around it until I figured out that the value of a wire was an equation with variables and if you knew the value of those variables you could substitute the equation for the resulting value. Keep looping over the wires until solved. If I had a cs background I'd probably create a graph from all the rules and walk it top to bottom, but eh close enough!
|
# ? Dec 14, 2015 12:24 |
|
KARMA! posted:I spent so much time on 9 to get a recursive thing to work without crapping on me. Turned out sometimes js really fucks with its variables. Nothing a judicious use of var can't fix, but I still don't know where exactly it went wrong. Bah humbug. I think that's what I'm going to have to do. My first attempt has been to transpile it to JS (bn RSHIFT 2 -> bo => function bo_wire(){return bn_wire() >> 2;}) and let the interpreter figure out the graph for me but that's so loving slow I left it running all day and it hadn't finished, which I expected problem 5 to do, but nooo - that took whole seconds. Second attempt was changing the transpiler to emit F# and then try to sort the calls to make it a valid F# program (single-pass compilers in tyool 2015!), but I can't get that second part of that right and doing it by hand? Bleh Would have been done with this in an hour if my first attempt worked as well as I'd hoped.
|
# ? Dec 14, 2015 15:53 |
|
|
# ? May 13, 2024 09:46 |
|
Why is the site down just as I decided to procrastinate and code? Also 9 (and 14, duh) is the one that I haven't done yet. Its not hard per se, it will just take some annoying boilerplate I don't care for writing, especially since I want to do it properly. (Construct an ad-hoc graph and then solve it by going from the leaves.)
|
# ? Dec 14, 2015 17:01 |