A place to post my solutions to some coding challenges. You can read more about the puzzles at Advent of Code
I haven’t solidified my format yet, but this page will be the link to everything that I have connected to Advent of Code
When I started the Day 1 and Day 2 challenges, I thought that I’d just use a spreadsheet. And of course I didn’t document them. But I did get my two stars for each day. Spreadsheet for Day 1 & 2
With Day 3, I started with just a spreadsheet, but ended up doing the work in a Visual Basic macro inside the spreadsheet. Day 3 solution To run it, you will have to enable the macro. You can look at it – if you read through it, you’ll see that there is no secret code to erase your hard drive…
Day 4 solution – posted as an .xls file (Excel 97-2003). The code is pasted into the top worksheet for inspection.
Day 5 solution – posted as an .xls file. The code is pasted into a second worksheet. I added some graphics to it, just because spreadsheets allow it. But I wasn’t happy with my solution – it required declaring a p(1000,1000) array of integers. That doesn’t scale much larger than that. I was going to read the hints to see how they did it, but the hints don’t show up after you have solved the problem. But the graphics were fun: (I tried a solution that used the table of shapes to hold the intersections, but that didn’t go at all well.
Day 6 solution – I started off with recursion and got into a real mess. Then I realized that all individuals of each age group were exactly the same. A spreadsheet did a great job of managing the data.
Day 7 solution – Continuing with the theme of Excel allowing you to add cute additions without too much work, this spreadsheet graphs approximations of the data, estimates the minimum and then narrows the section examined for the next try. When it is down to ten points, it records the minimum. I suppose that it could have done it in one pass by brute repetition, but this was more fun (and not quite as many calculations…)
Day 8 solution – Nothing profound to say about this one. It made a little more sense after I read about what a ‘seven-segment display’ was. Nor any interesting picture to show. Started with all possibilities and threw out the ones that didn’t work, one by one. When left with only one, the answer has been determined…
Day 9 solution – OK, Day 9 was a lot of fun. It has some of the same aspects of paint programs – counting (or filling) an area of contiguous cells. Which is a classic recursion problem. When recursion works, it’s pretty cool!
Day 10: Syntax Scoring –
Stacks appear to be the key to completing this problem. An internet search implies that VB Excel contains pre-defined stack types, but they don’t seem to work in my Office 2010 version. So I used a standard array with the 0th element being the number of elements and wrote simple push and pop procedures. Day 10 solution. Nothing special to show a picture of…
Day 11: Flashing Octopuses –
Another chance at recursion. I’ve read that anything that can be solved with recursion can also be done iteratively – but I wouldn’t want to try it with this one. Day 11 solution.
Given this is all about flashing lights, it really suggests some graphics. I’ve posted a video (28 seconds…) of the gradual synchronization of flashes leading up to the solution of part B.
Day 12: Passage Pathing –
Mapping possible paths through a collection of caves. I had to think about this one for quite a while… Recursion seems to be the way to go – and I had to remember about long integers. 32,000 just isn’t big enough… Day 12 solution.
Other Links: Back to Tim Q’s Advent of Code page – he’s the guy that got me into this…