Rightward Assignment in Ruby - Day 04 - Advent of Code 2023

Dive into the Advent of Code 2023 Day 4 puzzle with a Ruby twist! In this episode, titled "Scratch Cards," we’ll focus on harnessing the power of Ruby's rightward assignment feature for a challenge.

We start by setting up our input data, consisting of winning numbers and our own numbers, separated by a pipe operator. The goal is to determine how often our numbers appear in the winning numbers, with points doubling for each match. This episode walks you through each process step, from parsing the input with here-docs to utilizing rightward assignment for efficient code structuring.

Our journey includes pattern matching and array manipulation. The second part of the puzzle adds a twist, where scratch cards yield more cards instead of points, leading to a cascading effect in card duplication.

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