Spaceship operator - Day 07 - Advent of Code 2023

This video tackles the "Camel Cards" poker puzzle. We’ll parse the input data into Hand objects, modeling ranks, and bids. We can sort hands by type and strength by including the Comparable module and implementing spaceship logic.

For part 1, we’ll build a card counter and hand typing system, assigning numeric ranks. This lets us multiply bids by position to get total winnings. For part 2's joker rules, we’ll tweak the ranks and add joker offset logic to promote hands.

The core solution focuses on custom classes and comparable spaceships for sorting. I polish with enumerable pipelines for a concise answer. While not golf code, we end up with readable Ruby leveraging objects, sorting, and clever tricks.

Advent of Code: https://adventofcode.com/
My Solutions: https://gist.github.com/cjavdev/d15a2a4ffed6c840c2fb28a093e9f927/
Playlist https://www.youtube.com/playlist?list=PLS6F722u-R6KYlGyUv65EFpGKl2Esmurr

#adventofcode #ruby