Skip to content

Instantly share code, notes, and snippets.

@therubyhound
therubyhound / saftey_manual.rb
Created December 5, 2024 23:09
Advent of Code 2024, Day 5
require "miNitest/autorun"
require "debug"
class SafetyManual
attr_reader :rules, :pages
def initialize(input)
@rules, @pages = parse input
end
@therubyhound
therubyhound / word_search.rb
Created December 5, 2024 23:08
Advent of Code 2024, Day 4
require "minitest/autorun"
INPUT = DATA.read
class WordSearch
attr_reader :grid
def initialize(input)
@grid = parse input
@max_row = grid.count - 1
@therubyhound
therubyhound / recovery.rb
Created December 3, 2024 19:56
Advent of Code 2024, Day 3
require "minitest/autorun"
class Recovery
def initialize(input, parser: BasicParser)
@input = input
@parser = parser
end
def total
data.sum { |x, y| x.to_i * y.to_i }
@therubyhound
therubyhound / reactor.rb
Created December 2, 2024 21:45
Advent of Code 2024, Day 2
require "minitest/autorun"
class Reactor
attr_reader :data
def initialize(input)
@data = parse input
end
def safe_count
@therubyhound
therubyhound / location_data.rb
Last active December 2, 2024 23:09
Advent of Code 2024, Day 1: ruby location_data.rb day_1.txt
require "minitest/autorun"
INPUT = DATA.read
class LocationDataTest < Minitest::Test
def test_total_distance
location_list = LocationData.new(INPUT)
assert_equal 11, location_list.total_distance
end