Discussion thread for day 7 of the Advent of Code - https://adventofcode.com/2023/day/7
Tool golf version: total 13 tools
Calculate the type by Regex, and convert data into Hexa-decimal, and sort.
Got to use my favorite tool Tile :)
Day 7 was fun - the solution I came up with is not super pretty, but it works :-)
Almost tried some kind explode join, until I realise it is always better to replace J with the same letter.
Here's my solution.
For Part 1, I started by parsing the cards into rows, counted the number of cards per value in each hand, and used a couple of multi-row formula tools to determine if a hand was considered a "Full House" or "Two Pair." I then took the max count of each card per hand and labeled it as "[max count] of a kind" and created another lookup table to assign strength points based on the hand. After that, I created another lookup to assign values to each card and parsed the hands into 5 columns, one for each card with the value of the card from my lookup table. Finally, I sorted the hands first by hand strength in descending order, followed by card 1 in descending, then card 2 in descending, and so on, so that the sort order could be used to assign the final ranking to multiply by the bid.
For Part 2, I added a couple of extra formula tools to find the jokers and count how many jokers were in each hand. Then I created a lookup table with all the possible combinations with a joker and what the new hand would look like if the joker took on a different value and changed my card value lookup to include the jokers.