|
Munkeymon posted: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 https://github.com/JohnWang42/Advent-Code-Solutions/blob/master/day7.py Mine's in python, but what I did was take each unique value and add make it into an object. Each object stores the values and the operator. If the value is an unknown variable, it'll run the recursive resolve function on it when I want to get the value of a particular variable. Now the trick to making not run like poo poo was to also store the value of the variable once it was fully resolved. That way I'm not solving for the same drat thing a million times over.
|
# ? Dec 14, 2015 17:23 |
|
|
# ? Apr 26, 2024 17:02 |
|
IronDoge posted:https://github.com/JohnWang42/Advent-Code-Solutions/blob/master/day7.py Ah, so you just memoized results I just didn't think a ~300-line program with no loops could possibly take so long to resolve. 7 is appropriately Xmas-y in LinqPad because it shows you the call stack interactively in the gutter next to line numbers and it's like watching a strand of lights with a really good random setting.
|
# ? Dec 14, 2015 17:36 |
|
Xarn posted:Why is the site down just as I decided to procrastinate and code? Ah, sorry about that, I should have put a notice up this morning when the datacenter lost power >_< We were only out for like, 45 minutes. I'm just glad it happened at 10am and not near midnight :/ "Your server is offline" = worst alarm clock ever.
|
# ? Dec 15, 2015 02:29 |
|
--- Day 15: Science for Hungry People ---quote:Today, you set out on the task of perfecting your milk-dunking cookie recipe. All you have to do is find the right balance of ingredients.
|
# ? Dec 15, 2015 06:00 |
|
I like how you're giving us all these NP-complete problems but making the datasets juuust small enough that you can brute force them.
|
# ? Dec 15, 2015 12:34 |
|
LOOK I AM A TURTLE posted:I like how you're giving us all these NP-complete problems but making the datasets juuust small enough that you can brute force them. The best part about that is that you don't need to have arcane data structure knowledge (aka a cs degree) to participate.
|
# ? Dec 15, 2015 13:31 |
|
I loving hate Day 12 (was away for a week, catching up now). Phase 1 was able to do without a json parser and no regex's (yet, knock on wood). And it was really simple and clever. And in phase 2 now it makes me either make a json parser, use one or implement some mind-twisting, soul-hating state machine that I'll remember forever in the "what not to do" section of programming experiences. I guess I'll just have to get in line and use this son of jay ....
|
# ? Dec 16, 2015 05:44 |
|
--- Day 16: Aunt Sue ---quote:Your Aunt Sue has given you a wonderful gift, and you'd like to send her a thank you card. However, there's a small problem: she signed it "From, Aunt Sue".
|
# ? Dec 16, 2015 06:01 |
|
I think this one was faster to solve by hand than it would have been to write any code.
|
# ? Dec 16, 2015 06:17 |
|
Volguus posted:I loving hate Day 12 (was away for a week, catching up now). Phase 1 was able to do without a json parser and no regex's (yet, knock on wood). And it was really simple and clever. And in phase 2 now it makes me either make a json parser, use one or implement some mind-twisting, soul-hating state machine that I'll remember forever in the "what not to do" section of programming experiences. I said it once already, but I just used an ad-hoc brace matcher... C++ code:
|
# ? Dec 16, 2015 13:13 |
|
Xarn posted:I said it once already, but I just used an ad-hoc brace matcher... Yes, and then inbetween you had to find the offending string, then find_start again. I chose to keep a bit of my sanity and just use a drat parser.
|
# ? Dec 16, 2015 14:04 |
|
--- Day 17: No Such Thing as Too Much ---quote:The elves bought too much eggnog again - 150 liters this time. To fit it all into your refrigerator, you'll need to move it into smaller containers. You take an inventory of the capacities of the available containers.
|
# ? Dec 17, 2015 06:02 |
|
Volguus posted:Yes, and then inbetween you had to find the offending string, then find_start again. I chose to keep a bit of my sanity and just use a drat parser. Eh, the rest of the solution was just using string::find in a loop and a bit more logic to find the ending "}" if applicable. As for day 17, I'd love if the inputs started veering away from brute force. There is a proper and easy algorithm for this, but if I was doing these in Python I'd just brute force it because its easy and the input is insanely small.
|
# ? Dec 17, 2015 09:59 |
|
Thanks for posting this! I guess this is the time to familiarize myself with the basics of Javascript, I've been putting that off for much too long. Also most of the programming I'm doing nowadays is data transformation stuff, so it's nice to have some different challenges for once. Only have two stars so far, we'll see how far I'll come.
|
# ? Dec 17, 2015 14:26 |
|
I've been having a heck of a lot of fun with this, thanks so much for posting. I've been doing them in Node to improve my JS skills (transitioning from mostly Python) and these have been fun and interesting puzzles so far. My solutions here: https://github.com/technivore/adventofcode. I just finished Day 7 and man, that one was waaay harder for me than the first 6 days.
|
# ? Dec 17, 2015 22:46 |
|
--- Day 18: Like a GIF For Your Yard ---quote:After the million lights incident, the fire code has gotten stricter: now, at most ten thousand lights are allowed. You arrange them in a 100x100 grid.
|
# ? Dec 18, 2015 06:01 |
|
I've really been enjoying these puzzles. A lot of them are stuff I've done before through HackerRank or Project Euler, but the Christmas theming does make it more fun. Unfortunately I'm trying to do them in Ruby which I started picking up about 2 weeks ago so it's been harder for me than it ought to be. Day 12 Part 2 has currently broken me over it's knee and told me I'm a naughty boy who's not getting any gifts this year, though. I know how I'd do it in Python or C#, but the way Ruby aggressively passes by value means I'm having a hard time finding a way to traverse the tree while pruning objects off of it. There's probably some simple language feature I'm missing. Any Ruby people have any, uh, pointers that might help? ErIog fucked around with this message at 13:18 on Dec 18, 2015 |
# ? Dec 18, 2015 09:41 |
|
I haven't done it yet, but please tell me that part 2 is Game of Life on a toroidal board.
|
# ? Dec 18, 2015 11:00 |
|
ErIog posted:I've really been enjoying these puzzles. A lot of them are stuff I've done before through HackerRank or Project Euler, but the Christmas theming does make it more fun. Unfortunately I'm trying to do them in Ruby which I started picking up about 2 weeks ago so it's been harder for me than it ought to be. Lol, so turns out I'm real dumb and was doing recursion in a really stupid way that was breaking everything because I was trying to mix returning bools and returning actual objects in my recursive function. Once I flipped it to either returning or not returning objects based on their child objects I was golden.
|
# ? Dec 18, 2015 13:16 |
|
What I hope is that in January we would get the really nice and elegant solutions to all these problems which would put my brute-forced crap to shame.
|
# ? Dec 19, 2015 01:16 |
|
Volguus posted:What I hope is that in January we would get the really nice and elegant solutions to all these problems which would put my brute-forced crap to shame. If you found a nice, elegant, polynomial-time solution to most of these problems, you'd be off redefining human knowledge of mathematics rather than posting it as the solution to an internet programming puzzle.
|
# ? Dec 19, 2015 02:01 |
|
Volguus posted:What I hope is that in January we would get the really nice and elegant solutions to all these problems which would put my brute-forced crap to shame. There aren't that many clean and elegant solutions, if the solution megathreads in the subreddit are any indication. Most people are just coding as fast and as sloppily as they can in order to hit the leaderboard, and half as many are taking the easy way out with libraries like itertools. Ah well.
|
# ? Dec 19, 2015 03:14 |
|
--- Day 19: Medicine for Rudolph ---quote:Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, and he needs medicine.
|
# ? Dec 19, 2015 06:02 |
|
I thought this one was kind of boring at first since it has some similarities to previous permutation puzzles, but Part 2 makes it a lot more interesting.
|
# ? Dec 19, 2015 10:13 |
|
Just wanted to pop in and say thanks to the creator of this. (Though I hate that I probably wont ever get the entire tree lit up.)
|
# ? Dec 19, 2015 20:42 |
|
--- Day 20: Infinite Elves and Infinite Houses ---quote:To keep the Elves busy, Santa has them deliver some presents by hand, door-to-door.
|
# ? Dec 20, 2015 06:04 |
|
--- Day 21: RPG Simulator 20XX ---quote:Little Henry Case got a new video game for Christmas. It's an RPG, and he's stuck on a boss. He needs to know what equipment to buy at the shop. He hands you the controller.
|
# ? Dec 21, 2015 06:00 |
|
--- Day 22: Wizard Simulator 20XX ---quote:Little Henry Case decides that defeating bosses with swords and stuff is boring. Now he's playing the game with a wizard. Of course, he gets stuck on another boss and needs your help again.
|
# ? Dec 22, 2015 06:01 |
|
--- Day 23: Opening the Turing Lock ---quote:Little Jane Marie just got her very first computer for Christmas from some unknown benefactor. It comes with instructions and an example program, but the computer itself seems to be malfunctioning. She's curious what the program does, and would like you to help her run it.
|
# ? Dec 23, 2015 06:00 |
|
<30 mins to write the interpreter, >60 mins to find the one bug which was caused by sloppy reading of the instructions.
|
# ? Dec 23, 2015 10:48 |
|
Man, it really feels like the difficulty in these has ramped up lately, and yet, the top 100 on the leaderboard seem to always be half hour or less solves. I'm still stuck on finding algorithms for days 19 and 20 that can run in a reasonable amount of time.
|
# ? Dec 24, 2015 02:41 |
|
Spraynard Kruger posted:Man, it really feels like the difficulty in these has ramped up lately, and yet, the top 100 on the leaderboard seem to always be half hour or less solves. I'm still stuck on finding algorithms for days 19 and 20 that can run in a reasonable amount of time. Oh no, sir. Day 19 took drat near 4 hours just to cap the leaderboard at 100 gold. I had to go to work at 9am. :/ Good luck!
|
# ? Dec 24, 2015 06:04 |
|
--- Day 24: It Hangs in the Balance ---quote:It's Christmas Eve, and Santa is loading up the sleigh for this year's deliveries. However, there's one small problem: he can't get the sleigh to balance. If it isn't balanced, he can't defy physics, and nobody gets presents this year.
|
# ? Dec 24, 2015 06:04 |
|
On twitter Dec 16th Eric Wastl posted:Today is the last easy #AdventOfCode puzzle. It's all uphill from here. (Or downhill, if it were a roller coaster.) With the exception of today and day 19 part 2 I don't think the recent ones have been harder though. I think the worst ones before that was Day 12 part 2 and Day 7.
|
# ? Dec 24, 2015 11:54 |
|
And now for the grand finale... --- Day 25: Let It Snow --- quote:Merry Christmas! Santa is booting up his weather machine; looks like you might get a white Christmas after all. Merry Christmas, everyone!
|
# ? Dec 25, 2015 06:02 |
|
Urgh, I finished 16 and 21-25 by hand (being away from my normal dev machine), but now I guess I need to find somewhere to actually code up solutions to 17-20. How long is this going to be up?
|
# ? Dec 25, 2015 10:31 |
|
Jabor posted:
Since I won't have time to even start #1 until next week, I would love to know this as well.
|
# ? Dec 25, 2015 17:47 |
|
Jabor posted:Urgh, I finished 16 and 21-25 by hand (being away from my normal dev machine), but now I guess I need to find somewhere to actually code up solutions to 17-20. My friend has no plans to take it down. As long as the server can handle the traffic, it'll stay up.
|
# ? Dec 25, 2015 19:19 |
|
Finally had time to return to the problems after a busy December and restart all the way back at problem 7. Having it laid bare that I'm a systems programmer with little knowledge of algorithms is teeth-gritting sometimes, but that makes it all the more gratifying when I get the solution.
|
# ? Dec 26, 2015 22:28 |
|
|
# ? Apr 26, 2024 17:02 |
|
chutwig posted:Finally had time to return to the problems after a busy December and restart all the way back at problem 7. Having it laid bare that I'm a systems programmer with little knowledge of algorithms is teeth-gritting sometimes, but that makes it all the more gratifying when I get the solution. You are in luck then, most of the problems are either intended to be solved by brute force, or solvable by using brute force because of small problem size.
|
# ? Dec 27, 2015 09:56 |