Skip to main content

Module day07

Module day07 

Source
Expand description

§Camel Cards

The type of each hand is computed from the frequency of its cards in descending order. For example, a full house has 1 card with a frequency of 3 and a second with a frequency of 2, giving [3, 2]. Similarly, two pair is [2, 2, 1]. To make comparisons faster the frequencies and the card ranks are packed into a usize, for example:

  • 55222 => 0x3200055222
  • 32T3K => 0x2111032a3d

For part two, the strongest hand type is always made by adding the number of jokers to the highest frequency card (which could also be jokers in the case of JJJJJ).

  • QQQJA => 0x41000ccc1a

Structs§

Hand

Functions§

parse
part1
part2
winnings 🔒