AoC 2020 D22: Crab Combat
| Problem statement | Source code | Tags: Data structuresRecursion
← Previous Back to AoC Index Next →
Part 1
This feels back to day 10: literally play the game as asked. The only optimization is to use a deque instead of a list for the players' decks, since we need efficient popping from the front and appending to the back. But since there are only 50 cards in total, even using lists would be fine.
Part 2
Might be surprising that there's really no trick than just faithfully implementing the rules as described. Every single line corresponds to something in the problem statement, so no further explanation is needed.