Today's problem came with a pretty complex explanation, but solving the first part was pretty simple. I created a MarbleGame class that dealt with the actual game mechanics. My solution was pretty straight forward by using a list to save the circle's state and loop through each marble. It worked pretty good for finding the solution for the first part of the problem.
30 posts tagged with "Advent"
View All TagsDay 8: Memory Maneuver
First problem where I used recursion. Traversing trees is just so much easier with recursion.
Day 7: The Sum of Its Parts
Nice little graph problem today. I started by creating a Step class which contained references to other steps it depended on. The first part was then solved by looping and flagging steps as completed until all step where completed. Finding the next step to complete simply involved a little LINQ to determine the first (considering a list of steps ordered alphabetically) incomplete step for which all its requirements are completed:
Day 6: Chronal Coordinates
This problem had me thinking a little more at the start, especially in how should I determine if a location's area is finite or not. I ended up calculating the areas of each location by going through each possible coordinate in the map and finding the closest location to it, then if a location's area contained a coordinate on the border of the map, that location's area should be infinite.
Day 5: Alchemical Reduction
Back to string manipulations for this one. Nice problem but I found the solution a little to simple compared to the last two problems, especially for the second part.