Module aoc::year2022::day02

source ·
Expand description

§Rock Paper Scissors

With so few combinations it’s possible to precompute the values for each scenario by hand then quickly look them up for each game.

Functions§

  • Map each line from one of the 9 possible combinations (“A”, “B” or “C” followed by “X”, “Y” or “Z”) to between 0 and 8 inclusive.
  • Map each index to a score using a small precomputed lookup table.
  • Map each index to a (different) score using a second small precomputed lookup table.