Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
IronDoge
Nov 6, 2008

Ooh, I'm always up for some coding challenges.

Adbot
ADBOT LOVES YOU

IronDoge
Nov 6, 2008

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.

IronDoge
Nov 6, 2008

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.

IronDoge
Nov 6, 2008

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 :(

Would have been done with this in an hour if my first attempt worked as well as I'd hoped.

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.

IronDoge
Nov 6, 2008

I never finished last year's stuff, so luckily I have things to do after I finish this year's easy beginning puzzles! I inadvertently solved both parts of the Day 8 today when I made a visualizer to help debug the first part.

My python solutions

  • Locked thread