From 464c3ce0681d64b46a675fee62077c1d7820c34c Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:24:25 -0500 Subject: [PATCH 01/18] rubocopness and file renaming --- 2024/ruby/lib/advent_01_hystorian_hysteria.rb | 4 +- 2024/ruby/lib/advent_02_red_nosed_reports.rb | 4 +- 2024/ruby/lib/advent_03_mull_it_over.rb | 2 +- 2024/ruby/lib/advent_04_ceres_search.rb | 20 +- ...b => advent_01_hystorian_hysteria_spec.rb} | 26 +-- ...rb => advent_02_red_nosed_reports_spec.rb} | 43 ++-- 2024/ruby/spec/advent_03_mull_it_over_spec.rb | 52 +++++ 2024/ruby/spec/advent_03_spec.rb | 53 ----- 2024/ruby/spec/advent_04_ceres_search_spec.rb | 212 ++++++++++++++++++ 2024/ruby/spec/advent_04_spec.rb | 212 ------------------ 2024/ruby/spec/spec_helper.rb | 2 +- 11 files changed, 314 insertions(+), 316 deletions(-) rename 2024/ruby/spec/{advent_01_spec.rb => advent_01_hystorian_hysteria_spec.rb} (59%) rename 2024/ruby/spec/{advent_02_spec.rb => advent_02_red_nosed_reports_spec.rb} (56%) create mode 100644 2024/ruby/spec/advent_03_mull_it_over_spec.rb delete mode 100644 2024/ruby/spec/advent_03_spec.rb create mode 100644 2024/ruby/spec/advent_04_ceres_search_spec.rb delete mode 100644 2024/ruby/spec/advent_04_spec.rb diff --git a/2024/ruby/lib/advent_01_hystorian_hysteria.rb b/2024/ruby/lib/advent_01_hystorian_hysteria.rb index 61e061d..a57278f 100644 --- a/2024/ruby/lib/advent_01_hystorian_hysteria.rb +++ b/2024/ruby/lib/advent_01_hystorian_hysteria.rb @@ -1,8 +1,8 @@ -require 'pry' +require "pry" class DistanceCalculator def initialize(list_one, list_two) - raise 'lists must be the same length' if list_one.length != list_two.length + raise "lists must be the same length" if list_one.length != list_two.length @list_one = list_one @list_two = list_two diff --git a/2024/ruby/lib/advent_02_red_nosed_reports.rb b/2024/ruby/lib/advent_02_red_nosed_reports.rb index b64d901..b321504 100644 --- a/2024/ruby/lib/advent_02_red_nosed_reports.rb +++ b/2024/ruby/lib/advent_02_red_nosed_reports.rb @@ -6,7 +6,7 @@ def initialize(levels) end def initial_direction(levels) - levels.length > 1 && levels[0] < levels[1] ? 'increasing' : 'decreasing' + levels.length > 1 && levels[0] < levels[1] ? "increasing" : "decreasing" end def safe_with_dampener? @@ -44,7 +44,7 @@ def safe? end def valid_direction?(direction, level, prev) - (prev < level && direction == 'increasing') || (prev > level && direction == 'decreasing') + (prev < level && direction == "increasing") || (prev > level && direction == "decreasing") end def adjacent_safe?(prev, level) diff --git a/2024/ruby/lib/advent_03_mull_it_over.rb b/2024/ruby/lib/advent_03_mull_it_over.rb index cc0d827..e749462 100644 --- a/2024/ruby/lib/advent_03_mull_it_over.rb +++ b/2024/ruby/lib/advent_03_mull_it_over.rb @@ -25,7 +25,7 @@ def uncorrupted_pieces end def process_piece(str) - splits = str.tr('^0123456789,', '').split(',') + splits = str.tr("^0123456789,", "").split(",") splits[0].to_i * splits[1].to_i end diff --git a/2024/ruby/lib/advent_04_ceres_search.rb b/2024/ruby/lib/advent_04_ceres_search.rb index f5e3aa8..412c635 100644 --- a/2024/ruby/lib/advent_04_ceres_search.rb +++ b/2024/ruby/lib/advent_04_ceres_search.rb @@ -1,7 +1,7 @@ class WordSearch attr_reader :data, :word - def initialize(data, word = 'XMAS') + def initialize(data, word = "XMAS") @data = data @word = word end @@ -19,16 +19,16 @@ def count_at(row, col) end def letter_at(row, col) - in_bounds?(row, col) ? data[row][col] : '' + in_bounds?(row, col) ? data[row][col] : "" end def horizontal_word(row, col) first = col last = col + word.length - 1 - return '' unless in_bounds?(first, last) + return "" unless in_bounds?(first, last) - data[row][first..last] * '' + data[row][first..last] * "" end def horizontal?(row, col) @@ -38,7 +38,7 @@ def horizontal?(row, col) def vertical_word(row, col) (row..row + word.length - 1).map do |pos| letter_at(pos, col) - end * '' + end * "" end def vertical?(row, col) @@ -48,25 +48,25 @@ def vertical?(row, col) def diagonal_top_left_word(row, col) (0..word.length - 1).map do |pos| letter_at(row - pos, col - pos) - end * '' + end * "" end def diagonal_top_right_word(row, col) (0..word.length - 1).map do |pos| letter_at(row - pos, col + pos) - end * '' + end * "" end def diagonal_bottom_right_word(row, col) (0..word.length - 1).map do |pos| letter_at(row + pos, col + pos) - end * '' + end * "" end def diagonal_bottom_left_word(row, col) (0..word.length - 1).map do |pos| letter_at(row + pos, col - pos) - end * '' + end * "" end def match?(str) @@ -74,7 +74,7 @@ def match?(str) end def cross_word_at?(row, col) - cross_word = 'MAS' + cross_word = "MAS" diag_1 = letter_at(row - 1, col - 1) + letter_at(row, col) + letter_at(row + 1, col + 1) diag_2 = letter_at(row + 1, col - 1) + letter_at(row, col) + letter_at(row - 1, col + 1) diff --git a/2024/ruby/spec/advent_01_spec.rb b/2024/ruby/spec/advent_01_hystorian_hysteria_spec.rb similarity index 59% rename from 2024/ruby/spec/advent_01_spec.rb rename to 2024/ruby/spec/advent_01_hystorian_hysteria_spec.rb index e9c24ab..f6edb88 100644 --- a/2024/ruby/spec/advent_01_spec.rb +++ b/2024/ruby/spec/advent_01_hystorian_hysteria_spec.rb @@ -1,22 +1,22 @@ -require 'spec_helper' -require 'advent_01_hystorian_hysteria' +require "spec_helper" +require "advent_01_hystorian_hysteria" -describe 'DistanceCalculator' do +describe "DistanceCalculator" do let(:data) do - File.readlines('./spec/fixtures/advent-01.txt').each do |line| - line.chomp.gsub(/\s+/, ' ') + File.readlines("./spec/fixtures/advent-01.txt").each do |line| + line.chomp.gsub(/\s+/, " ") end end let(:list_one) do - data.map { |line| line.split(' ')[0].to_i } + data.map { |line| line.split(" ")[0].to_i } end let(:list_two) do - data.map { |line| line.split(' ')[1].to_i } + data.map { |line| line.split(" ")[1].to_i } end - it 'calculates distance' do + it "calculates distance" do calc = DistanceCalculator.new([], []) result = calc.distance(1, 3) @@ -24,13 +24,13 @@ expect(result).to be(2) end - it 'calculates total distance' do + it "calculates total distance" do calc = DistanceCalculator.new(list_one, list_two) expect(calc.total_distance).to eq(2_166_959) end - it 'calculates similarity distance with matching number' do + it "calculates similarity distance with matching number" do a = [3, 4, 2, 1, 3, 3] b = [4, 3, 5, 3, 9, 3] calc = DistanceCalculator.new(a, b) @@ -38,7 +38,7 @@ expect(calc.similarity(4)).to eq(4) end - it 'calculates similarity distance with multiple matches' do + it "calculates similarity distance with multiple matches" do a = [3, 4, 2, 1, 3, 3] b = [4, 3, 5, 3, 9, 3] calc = DistanceCalculator.new(a, b) @@ -46,7 +46,7 @@ expect(calc.similarity(3)).to eq(9) end - it 'calculates similarity distance with missing number' do + it "calculates similarity distance with missing number" do a = [3, 4, 2, 1, 3, 3] b = [4, 3, 5, 3, 9, 3] calc = DistanceCalculator.new(a, b) @@ -54,7 +54,7 @@ expect(calc.similarity(2)).to eq(0) end - it 'calculates total similarity distance' do + it "calculates total similarity distance" do calc = DistanceCalculator.new(list_one, list_two) expect(calc.total_similarity_score).to eq(23_741_109) diff --git a/2024/ruby/spec/advent_02_spec.rb b/2024/ruby/spec/advent_02_red_nosed_reports_spec.rb similarity index 56% rename from 2024/ruby/spec/advent_02_spec.rb rename to 2024/ruby/spec/advent_02_red_nosed_reports_spec.rb index 0947a14..9affb9e 100644 --- a/2024/ruby/spec/advent_02_spec.rb +++ b/2024/ruby/spec/advent_02_red_nosed_reports_spec.rb @@ -1,82 +1,81 @@ -require 'spec_helper' -require 'pry' -require 'advent_02_red_nosed_reports' +require "spec_helper" +require "advent_02_red_nosed_reports" -describe 'Report' do - context 'with safe increasing levels' do +describe "Report" do + context "with safe increasing levels" do let(:levels) { [5, 6, 7, 8, 9, 10] } - it 'is safe' do + it "is safe" do report = Report.new(levels) expect(report.safe?).to be(true) end end - context 'with safe decreasing levels' do + context "with safe decreasing levels" do let(:levels) { [5, 4, 3, 2, 1] } - it 'is safe' do + it "is safe" do report = Report.new(levels) expect(report.safe?).to be(true) end end - context 'with mixed levels' do + context "with mixed levels" do let(:levels) { [5, 4, 6] } - it 'is not safe' do + it "is not safe" do report = Report.new(levels) expect(report.safe?).to be(false) end end - context 'with bad adjacent levels' do + context "with bad adjacent levels" do let(:levels) { [1, 2, 4, 8, 9] } - it 'is not safe' do + it "is not safe" do report = Report.new(levels) expect(report.safe?).to be(false) end end - context 'with sample data' do + context "with sample data" do let(:data) do - File.readlines('spec/fixtures/advent-02-sample.txt').map do |e| - e.chomp.split(' ').map(&:to_i) + File.readlines("spec/fixtures/advent-02-sample.txt").map do |e| + e.chomp.split(" ").map(&:to_i) end end - it 'calculates how many are safe' do + it "calculates how many are safe" do safe = data.select { |levels| Report.new(levels).safe? } expect(safe.length).to be(2) end - it 'calculates how many are safe with a dampener of 1' do + it "calculates how many are safe with a dampener of 1" do safe = data.select { |levels| Report.new(levels).safe_with_dampener? } expect(safe.length).to be(4) end end - context 'with puzzle data' do + context "with puzzle data" do let(:data) do - File.readlines('spec/fixtures/advent-02.txt').map do |e| - e.chomp.split(' ').map(&:to_i) + File.readlines("spec/fixtures/advent-02.txt").map do |e| + e.chomp.split(" ").map(&:to_i) end end - it 'calculates how many are safe' do + it "calculates how many are safe" do safe = data.select { |levels| Report.new(levels).safe? } expect(safe.length).to be(660) end - it 'calculates how many are safe with a dampener of 1' do + it "calculates how many are safe with a dampener of 1" do safe = data.select { |levels| Report.new(levels).safe_with_dampener? } expect(safe.length).to be(689) diff --git a/2024/ruby/spec/advent_03_mull_it_over_spec.rb b/2024/ruby/spec/advent_03_mull_it_over_spec.rb new file mode 100644 index 0000000..6aee231 --- /dev/null +++ b/2024/ruby/spec/advent_03_mull_it_over_spec.rb @@ -0,0 +1,52 @@ +require "spec_helper" +require "advent_03_mull_it_over" + +describe "Muller" do + context "with uncorrupted pieces" do + let(:data) { File.read("./spec/fixtures/advent-03-sample-ii.txt").chomp } + + it "parses uncorrupted pieces" do + muller = Muller.new(data) + + expect(muller.uncorrupted_pieces).to eq(["mul(2,4)", "mul(8,5)"]) + end + + it "mulls uncorrupted data" do + muller = Muller.new(data) + + expect(muller.uncorrupted_mull).to eq(48) + end + end + + context "with sample data" do + let(:data) { File.read("./spec/fixtures/advent-03-sample.txt").chomp } + + it "parses the pieces" do + muller = Muller.new(data) + + expect(muller.pieces).to eq(["mul(2,4)", "mul(5,5)", "mul(11,8)", "mul(8,5)"]) + end + + it "mulls the data" do + muller = Muller.new(data) + + expect(muller.mull).to eq(161) + end + end + + context "with puzzle data" do + let(:data) { File.read("./spec/fixtures/advent-03.txt").chomp } + + it "mulls the data" do + muller = Muller.new(data) + + expect(muller.mull).to eq(165_225_049) + end + + it "mulls uncorrupted data" do + muller = Muller.new(data) + + expect(muller.uncorrupted_mull).to eq(108_830_766) + end + end +end diff --git a/2024/ruby/spec/advent_03_spec.rb b/2024/ruby/spec/advent_03_spec.rb deleted file mode 100644 index 710e902..0000000 --- a/2024/ruby/spec/advent_03_spec.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'spec_helper' -require 'pry' -require 'advent_03_mull_it_over' - -describe 'Muller' do - context 'with uncorrupted pieces' do - let(:data) { File.read('./spec/fixtures/advent-03-sample-ii.txt').chomp } - - it 'parses uncorrupted pieces' do - muller = Muller.new(data) - - expect(muller.uncorrupted_pieces).to eq(['mul(2,4)', 'mul(8,5)']) - end - - it 'mulls uncorrupted data' do - muller = Muller.new(data) - - expect(muller.uncorrupted_mull).to eq(48) - end - end - - context 'with sample data' do - let(:data) { File.read('./spec/fixtures/advent-03-sample.txt').chomp } - - it 'parses the pieces' do - muller = Muller.new(data) - - expect(muller.pieces).to eq(['mul(2,4)', 'mul(5,5)', 'mul(11,8)', 'mul(8,5)']) - end - - it 'mulls the data' do - muller = Muller.new(data) - - expect(muller.mull).to eq(161) - end - end - - context 'with puzzle data' do - let(:data) { File.read('./spec/fixtures/advent-03.txt').chomp } - - it 'mulls the data' do - muller = Muller.new(data) - - expect(muller.mull).to eq(165_225_049) - end - - it 'mulls uncorrupted data' do - muller = Muller.new(data) - - expect(muller.uncorrupted_mull).to eq(108_830_766) - end - end -end diff --git a/2024/ruby/spec/advent_04_ceres_search_spec.rb b/2024/ruby/spec/advent_04_ceres_search_spec.rb new file mode 100644 index 0000000..6c193bc --- /dev/null +++ b/2024/ruby/spec/advent_04_ceres_search_spec.rb @@ -0,0 +1,212 @@ +require "spec_helper" +require "advent_04_ceres_search" + +describe "WordSearch" do + it "counts horizontal" do + data = [ + ["X", "M", "A", "S"], + [".", ".", ".", "."], + [".", ".", ".", "."], + [".", ".", ".", "."] + ] + + search = WordSearch.new(data) + expect(search.horizonal_count).to eq(1) + end + + it "counts horizontal in reverse" do + data = [ + ["S", "A", "M", "X"], + [".", ".", ".", "."], + [".", ".", ".", "."], + [".", ".", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.horizonal_count).to eq(1) + end + + it "counts vertical" do + data = [ + ["X", ".", ".", "."], + ["M", ".", ".", "."], + ["A", ".", ".", "."], + ["S", ".", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.vertical_count).to eq(1) + end + + it "counts vertical in reverse" do + data = [ + ["S", ".", ".", "."], + ["A", ".", ".", "."], + ["M", ".", ".", "."], + ["X", ".", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.vertical_count).to eq(1) + end + + it "counts downward diagonal" do + data = [ + ["X", ".", ".", "."], + [".", "M", ".", "."], + [".", ".", "A", "."], + [".", ".", ".", "S"] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(1) + end + + it "counts downward reverse diagonal" do + data = [ + ["S", ".", ".", "."], + [".", "A", ".", "."], + [".", ".", "M", "."], + [".", ".", ".", "X"] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(1) + end + + it "counts upward diagonal" do + data = [ + [".", ".", ".", "S"], + [".", ".", "A", "."], + [".", "M", ".", "."], + ["X", ".", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(1) + end + + it "counts upward reverse diagonal" do + data = [ + [".", ".", ".", "X"], + [".", ".", "M", "."], + [".", "A", ".", "."], + ["S", ".", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(1) + end + + it "counts crossing diagonals" do + data = [ + ["X", ".", ".", "S"], + [".", "M", "A", "."], + [".", "M", "A", "."], + ["X", ".", ".", "S"] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(2) + end + + it "counts cross diagonals" do + data = [ + ["S", ".", ".", "S"], + [".", "A", "A", "."], + [".", "M", "M", "."], + ["X", ".", ".", "X"] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(2) + end + + it "finds no matches" do + data = [ + %w[X X X X], + %w[X X X M], + %w[X X X X], + %w[A X X X], + %w[X S X X] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_count).to eq(0) + end + + it "counts diagonals" do + data = [ + [".", "S", ".", ".", ".", ".", ".", "S", ".", "."], + [".", ".", "A", ".", ".", ".", "A", ".", ".", "."], + [".", ".", ".", "M", ".", "M", ".", ".", ".", "."], + [".", ".", ".", ".", "X", ".", ".", ".", ".", "."], + [".", ".", ".", "M", ".", "M", ".", ".", ".", "."], + [".", ".", "A", ".", ".", ".", "A", ".", ".", "."], + [".", "S", ".", ".", ".", ".", ".", "S", ".", "."] + ] + + search = WordSearch.new(data) + + expect(search.diagonal_top_left_word(3, 4)).to eq("XMAS") + expect(search.diagonal_top_right_word(3, 4)).to eq("XMAS") + expect(search.diagonal_bottom_right_word(3, 4)).to eq("XMAS") + expect(search.diagonal_bottom_left_word(3, 4)).to eq("XMAS") + + expect(search.diagonal_count).to eq(4) + expect(search.word_count).to eq(4) + end + + it "counts cross words" do + data = [ + ["M", ".", "S"], + [".", "A", "."], + ["M", ".", "S"] + ] + + search = WordSearch.new(data) + + expect(search.cross_word_at?(1, 1)).to be(true) + expect(search.cross_word_count).to eq(1) + end + + context "with sample data" do + let(:data) do + File.readlines("./spec/fixtures/advent-04-sample.txt").map { |l| l.chomp.chars } + end + + it "finds counts of XMAS" do + search = WordSearch.new(data) + + expect(search.word_count).to eq(18) + end + end + + context "with puzzle data" do + let(:data) do + File.readlines("./spec/fixtures/advent-04.txt").map { |l| l.chomp.chars } + end + + it "finds counts of XMAS" do + search = WordSearch.new(data) + + expect(search.word_count).to eq(2447) + end + + it "finds cross word counts" do + search = WordSearch.new(data) + + expect(search.cross_word_count).to eq(1868) + end + end +end diff --git a/2024/ruby/spec/advent_04_spec.rb b/2024/ruby/spec/advent_04_spec.rb deleted file mode 100644 index fc222b2..0000000 --- a/2024/ruby/spec/advent_04_spec.rb +++ /dev/null @@ -1,212 +0,0 @@ -require 'spec_helper' -require 'advent_04_ceres_search' - -describe 'WordSearch' do - it 'counts horizontal' do - data = [ - ['X', 'M', 'A', 'S'], - ['.', '.', '.', '.'], - ['.', '.', '.', '.'], - ['.', '.', '.', '.'] - ] - - search = WordSearch.new(data) - expect(search.horizonal_count).to eq(1) - end - - it 'counts horizontal in reverse' do - data = [ - ['S', 'A', 'M', 'X'], - ['.', '.', '.', '.'], - ['.', '.', '.', '.'], - ['.', '.', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.horizonal_count).to eq(1) - end - - it 'counts vertical' do - data = [ - ['X', '.', '.', '.'], - ['M', '.', '.', '.'], - ['A', '.', '.', '.'], - ['S', '.', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.vertical_count).to eq(1) - end - - it 'counts vertical in reverse' do - data = [ - ['S', '.', '.', '.'], - ['A', '.', '.', '.'], - ['M', '.', '.', '.'], - ['X', '.', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.vertical_count).to eq(1) - end - - it 'counts downward diagonal' do - data = [ - ['X', '.', '.', '.'], - ['.', 'M', '.', '.'], - ['.', '.', 'A', '.'], - ['.', '.', '.', 'S'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(1) - end - - it 'counts downward reverse diagonal' do - data = [ - ['S', '.', '.', '.'], - ['.', 'A', '.', '.'], - ['.', '.', 'M', '.'], - ['.', '.', '.', 'X'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(1) - end - - it 'counts upward diagonal' do - data = [ - ['.', '.', '.', 'S'], - ['.', '.', 'A', '.'], - ['.', 'M', '.', '.'], - ['X', '.', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(1) - end - - it 'counts upward reverse diagonal' do - data = [ - ['.', '.', '.', 'X'], - ['.', '.', 'M', '.'], - ['.', 'A', '.', '.'], - ['S', '.', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(1) - end - - it 'counts crossing diagonals' do - data = [ - ['X', '.', '.', 'S'], - ['.', 'M', 'A', '.'], - ['.', 'M', 'A', '.'], - ['X', '.', '.', 'S'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(2) - end - - it 'counts cross diagonals' do - data = [ - ['S', '.', '.', 'S'], - ['.', 'A', 'A', '.'], - ['.', 'M', 'M', '.'], - ['X', '.', '.', 'X'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(2) - end - - it 'finds no matches' do - data = [ - %w[X X X X], - %w[X X X M], - %w[X X X X], - %w[A X X X], - %w[X S X X] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_count).to eq(0) - end - - it 'counts diagonals' do - data = [ - ['.', 'S', '.', '.', '.', '.', '.', 'S', '.', '.'], - ['.', '.', 'A', '.', '.', '.', 'A', '.', '.', '.'], - ['.', '.', '.', 'M', '.', 'M', '.', '.', '.', '.'], - ['.', '.', '.', '.', 'X', '.', '.', '.', '.', '.'], - ['.', '.', '.', 'M', '.', 'M', '.', '.', '.', '.'], - ['.', '.', 'A', '.', '.', '.', 'A', '.', '.', '.'], - ['.', 'S', '.', '.', '.', '.', '.', 'S', '.', '.'] - ] - - search = WordSearch.new(data) - - expect(search.diagonal_top_left_word(3, 4)).to eq('XMAS') - expect(search.diagonal_top_right_word(3, 4)).to eq('XMAS') - expect(search.diagonal_bottom_right_word(3, 4)).to eq('XMAS') - expect(search.diagonal_bottom_left_word(3, 4)).to eq('XMAS') - - expect(search.diagonal_count).to eq(4) - expect(search.word_count).to eq(4) - end - - it 'counts cross words' do - data = [ - ['M', '.', 'S'], - ['.', 'A', '.'], - ['M', '.', 'S'] - ] - - search = WordSearch.new(data) - - expect(search.cross_word_at?(1, 1)).to be(true) - expect(search.cross_word_count).to eq(1) - end - - context 'with sample data' do - let(:data) do - File.readlines('./spec/fixtures/advent-04-sample.txt').map { |l| l.chomp.chars } - end - - it 'finds counts of XMAS' do - search = WordSearch.new(data) - - expect(search.word_count).to eq(18) - end - end - - context 'with puzzle data' do - let(:data) do - File.readlines('./spec/fixtures/advent-04.txt').map { |l| l.chomp.chars } - end - - it 'finds counts of XMAS' do - search = WordSearch.new(data) - - expect(search.word_count).to eq(2447) - end - - it 'finds cross word counts' do - search = WordSearch.new(data) - - expect(search.cross_word_count).to eq(1868) - end - end -end diff --git a/2024/ruby/spec/spec_helper.rb b/2024/ruby/spec/spec_helper.rb index d7da771..19d7f15 100644 --- a/2024/ruby/spec/spec_helper.rb +++ b/2024/ruby/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'pry' +require "pry" # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. From 3e8cddb9435a26f3ddc87af4758dfbe084e99593 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:26:56 -0500 Subject: [PATCH 02/18] rubocop --- 2024/ruby/Gemfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/2024/ruby/Gemfile b/2024/ruby/Gemfile index 6a8e48d..cbf586b 100644 --- a/2024/ruby/Gemfile +++ b/2024/ruby/Gemfile @@ -1,18 +1,18 @@ # frozen_string_literal: true -source 'https://rubygems.org' +source "https://rubygems.org" -ruby File.open('.ruby-version', 'rb') { |f| f.read.chomp } +ruby File.open(".ruby-version", "rb") { |f| f.read.chomp } -gem 'awesome_print' +gem "awesome_print" -gem 'guard' -gem 'guard-rspec', require: false +gem "guard" +gem "guard-rspec", require: false -gem 'pry', '~> 0.15.0' +gem "pry", "~> 0.15.0" -gem 'rake', '~> 13.2' -gem 'rspec', '~> 3.13.0' -gem 'rubocop', '~> 1.69.0' -gem 'rubocop-rake', '0.6.0', require: false -gem 'rubocop-rspec', '3.2.0', require: false +gem "rake", "~> 13.2" +gem "rspec", "~> 3.13.0" +gem "rubocop", "~> 1.69.0" +gem "rubocop-rake", "0.6.0", require: false +gem "rubocop-rspec", "3.2.0", require: false From 34824fba25a9c2410aa19163168650bbd66be86f Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:27:03 -0500 Subject: [PATCH 03/18] remove debugging --- 2024/ruby/Rakefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/2024/ruby/Rakefile b/2024/ruby/Rakefile index e917db9..100bdaa 100644 --- a/2024/ruby/Rakefile +++ b/2024/ruby/Rakefile @@ -42,10 +42,6 @@ task :new do erb = ERB.new(File.read(h[:template])) rendered = erb.result_with_hash(require_path: basename, day_number: formatted_day) - puts "creating #{path}" - puts rendered.inspect - puts "----------------" - File.write(path, rendered) end From 2b70a2fa7d9b12665afb53cc68dd5c80a6db698f Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:27:13 -0500 Subject: [PATCH 04/18] rubocop --- 2024/ruby/Guardfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/2024/ruby/Guardfile b/2024/ruby/Guardfile index 5a83809..e35b7a4 100644 --- a/2024/ruby/Guardfile +++ b/2024/ruby/Guardfile @@ -26,8 +26,8 @@ # * zeus: 'zeus rspec' (requires the server to be started separately) # * 'just' rspec: 'rspec' -guard :rspec, cmd: 'bundle exec rspec' do - require 'guard/rspec/dsl' +guard :rspec, cmd: "bundle exec rspec" do + require "guard/rspec/dsl" dsl = Guard::RSpec::Dsl.new(self) # Feel free to open issues for suggestions and improvements @@ -67,6 +67,6 @@ guard :rspec, cmd: 'bundle exec rspec' do # Turnip features and steps watch(%r{^spec/acceptance/(.+)\.feature$}) watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| - Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' + Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" end end From 2da359d0f27f2604257f1f63020bb7ddf3a77c0f Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:40:53 -0500 Subject: [PATCH 05/18] update todo --- 2024/ruby/.rubocop_todo.yml | 27 ------------------------- 2024/ruby/lib/advent_04_ceres_search.rb | 16 +++++---------- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/2024/ruby/.rubocop_todo.yml b/2024/ruby/.rubocop_todo.yml index 0d0b31c..6ee478b 100644 --- a/2024/ruby/.rubocop_todo.yml +++ b/2024/ruby/.rubocop_todo.yml @@ -21,30 +21,3 @@ Metrics/BlockLength: # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: Max: 120 - -# Offense count: 2 -# Configuration parameters: EnforcedStyle, AllowedPatterns. -# SupportedStyles: snake_case, camelCase -Naming/MethodName: - Exclude: - - 'lib/advent_04_ceres_search.rb' - - 'test.rb' - -# Offense count: 2 -# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. -# SupportedStyles: snake_case, normalcase, non_integer -# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 -Naming/VariableNumber: - Exclude: - - 'lib/advent_04_ceres_search.rb' - -# Offense count: 4 -# Configuration parameters: AllowedConstants. -Style/Documentation: - Exclude: - - 'spec/**/*' - - 'test/**/*' - - 'lib/advent_01_hystorian_hysteria.rb' - - 'lib/advent_02_red_nosed_reports.rb' - - 'lib/advent_03_mull_it_over.rb' - - 'lib/advent_04_ceres_search.rb' diff --git a/2024/ruby/lib/advent_04_ceres_search.rb b/2024/ruby/lib/advent_04_ceres_search.rb index 412c635..92fa60a 100644 --- a/2024/ruby/lib/advent_04_ceres_search.rb +++ b/2024/ruby/lib/advent_04_ceres_search.rb @@ -76,13 +76,13 @@ def match?(str) def cross_word_at?(row, col) cross_word = "MAS" - diag_1 = letter_at(row - 1, col - 1) + letter_at(row, col) + letter_at(row + 1, col + 1) - diag_2 = letter_at(row + 1, col - 1) + letter_at(row, col) + letter_at(row - 1, col + 1) + diag1 = letter_at(row - 1, col - 1) + letter_at(row, col) + letter_at(row + 1, col + 1) + diag2 = letter_at(row + 1, col - 1) + letter_at(row, col) + letter_at(row - 1, col + 1) - diag_1_match = [cross_word, cross_word.reverse].any? { |str| str == diag_1 } - diag_2_match = [cross_word, cross_word.reverse].any? { |str| str == diag_2 } + diag1_match = [cross_word, cross_word.reverse].any? { |str| str == diag1 } + diag2_match = [cross_word, cross_word.reverse].any? { |str| str == diag2 } - diag_1_match && diag_2_match + diag1_match && diag2_match end def cross_word_count @@ -147,9 +147,3 @@ def render end end end - -def badName - return unless something - - test -end From efb6bb66518aa32d5333522b62f1c731ffe05cf6 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:44:08 -0500 Subject: [PATCH 06/18] try out workflow --- .github/workflows/2024-ruby.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index e2571b5..64454df 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -3,7 +3,6 @@ name: 2024-ruby on: pull_request: push: - branches: [master] paths: - 2024/ruby/** @@ -21,5 +20,8 @@ jobs: with: bundler-cache: true working-directory: ./2024/ruby + - name: RuboCop Linter Action + uses: andrewmcodes/rubocop-linter-action@v3.3.0 + - name: Run tests run: bundle exec rspec From 849cf707ad5cd481e046f2b12a792967956cd2a8 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:45:12 -0500 Subject: [PATCH 07/18] test --- .github/workflows/2024-ruby.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index 64454df..06c10b2 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -22,6 +22,5 @@ jobs: working-directory: ./2024/ruby - name: RuboCop Linter Action uses: andrewmcodes/rubocop-linter-action@v3.3.0 - - name: Run tests run: bundle exec rspec From 3e767311858271c534f45328e3d736289370f47a Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 13:57:52 -0500 Subject: [PATCH 08/18] try composite action --- .github/workflows/2024-ruby.yaml | 13 ++++++------- .github/workflows/shared/setup/action.yaml | 11 +++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/shared/setup/action.yaml diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index 06c10b2..e769b15 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -11,16 +11,15 @@ defaults: working-directory: ./2024/ruby jobs: - tests: + lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - working-directory: ./2024/ruby + - uses: "./.github/shared/setup" - name: RuboCop Linter Action uses: andrewmcodes/rubocop-linter-action@v3.3.0 + tests: + runs-on: ubuntu-latest + steps: + - uses: "./.github/shared/setup" - name: Run tests run: bundle exec rspec diff --git a/.github/workflows/shared/setup/action.yaml b/.github/workflows/shared/setup/action.yaml new file mode 100644 index 0000000..71a3085 --- /dev/null +++ b/.github/workflows/shared/setup/action.yaml @@ -0,0 +1,11 @@ +name: "setup ruby" + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + working-directory: ./2024/ruby From 437083b0c1ba50bb6bbe625fe7e51c9e836fe725 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:00:11 -0500 Subject: [PATCH 09/18] rename --- .github/{workflows => }/shared/setup/action.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflows => }/shared/setup/action.yaml (100%) diff --git a/.github/workflows/shared/setup/action.yaml b/.github/shared/setup/action.yaml similarity index 100% rename from .github/workflows/shared/setup/action.yaml rename to .github/shared/setup/action.yaml From eec9e776a02715b88e104ce79937378731454322 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:01:26 -0500 Subject: [PATCH 10/18] wip --- .github/shared/setup/action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/shared/setup/action.yaml b/.github/shared/setup/action.yaml index 71a3085..e869b66 100644 --- a/.github/shared/setup/action.yaml +++ b/.github/shared/setup/action.yaml @@ -1,4 +1,5 @@ name: "setup ruby" +description: "checks out code and sets up ruby" runs: using: "composite" From 2608ea4dfaa3287e06454ef2466a6442a18c7eac Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:03:20 -0500 Subject: [PATCH 11/18] wip --- .github/shared/setup/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/shared/setup/action.yaml b/.github/shared/setup/action.yaml index e869b66..398db6c 100644 --- a/.github/shared/setup/action.yaml +++ b/.github/shared/setup/action.yaml @@ -4,7 +4,8 @@ description: "checks out code and sets up ruby" runs: using: "composite" steps: - - uses: actions/checkout@v3 + - name: Check out code + uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From 6fd6b15a1f0041d00247721610871e167e591bb4 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:04:22 -0500 Subject: [PATCH 12/18] wip --- .github/workflows/2024-ruby.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index e769b15..ab8868e 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -14,12 +14,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: "./.github/shared/setup" - - name: RuboCop Linter Action - uses: andrewmcodes/rubocop-linter-action@v3.3.0 + - uses: "./.github/shared/setup" + - name: RuboCop Linter Action + uses: andrewmcodes/rubocop-linter-action@v3.3.0 tests: runs-on: ubuntu-latest steps: - - uses: "./.github/shared/setup" - - name: Run tests - run: bundle exec rspec + - uses: "./.github/shared/setup" + - name: Run tests + run: bundle exec rspec From 9504b22c4f7809aa7c8eae2e055cf2772db15cc1 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:08:42 -0500 Subject: [PATCH 13/18] wip --- .github/shared/setup/action.yaml | 2 +- .github/workflows/2024-ruby.yaml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/shared/setup/action.yaml b/.github/shared/setup/action.yaml index 398db6c..357cc36 100644 --- a/.github/shared/setup/action.yaml +++ b/.github/shared/setup/action.yaml @@ -1,5 +1,5 @@ name: "setup ruby" -description: "checks out code and sets up ruby" +description: "sets up ruby" runs: using: "composite" diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index ab8868e..c303ad4 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -14,12 +14,14 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: "./.github/shared/setup" + - uses: actions/checkout@v3 + - uses: ./.github/shared/setup - name: RuboCop Linter Action uses: andrewmcodes/rubocop-linter-action@v3.3.0 tests: runs-on: ubuntu-latest steps: - - uses: "./.github/shared/setup" + - uses: actions/checkout@v3 + - uses: ./.github/shared/setup - name: Run tests run: bundle exec rspec From f563a920f798542bdbee23ec2d91ab4e1459fad7 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:11:51 -0500 Subject: [PATCH 14/18] wip --- .github/workflows/2024-ruby.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index c303ad4..d1350f7 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -16,8 +16,7 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./.github/shared/setup - - name: RuboCop Linter Action - uses: andrewmcodes/rubocop-linter-action@v3.3.0 + - uses: andrewmcodes/rubocop-linter-action@v3.3.0 tests: runs-on: ubuntu-latest steps: From 5d970f6de1b8aeaa6e1f23fa1df58b73382bfd93 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:18:23 -0500 Subject: [PATCH 15/18] wip --- .github/workflows/2024-ruby.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index d1350f7..ce2fe8c 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -16,7 +16,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./.github/shared/setup - - uses: andrewmcodes/rubocop-linter-action@v3.3.0 + - name: Run rubocop + run: bundle exec rubocop tests: runs-on: ubuntu-latest steps: From 3d6709278ecd222b782aa9a14043c50ef3d90230 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:20:30 -0500 Subject: [PATCH 16/18] wip --- .github/shared/setup/action.yaml | 4 +--- .github/workflows/2024-ruby.yaml | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/shared/setup/action.yaml b/.github/shared/setup/action.yaml index 357cc36..bc7ca11 100644 --- a/.github/shared/setup/action.yaml +++ b/.github/shared/setup/action.yaml @@ -1,11 +1,9 @@ name: "setup ruby" -description: "sets up ruby" +description: "setup ruby" runs: using: "composite" steps: - - name: Check out code - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/2024-ruby.yaml b/.github/workflows/2024-ruby.yaml index ce2fe8c..72ae51d 100644 --- a/.github/workflows/2024-ruby.yaml +++ b/.github/workflows/2024-ruby.yaml @@ -15,13 +15,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/shared/setup + - name: Setup Ruby + uses: ./.github/shared/setup - name: Run rubocop run: bundle exec rubocop tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/shared/setup + - name: Setup Ruby + uses: ./.github/shared/setup - name: Run tests run: bundle exec rspec From 54d45d3148fa2619102b29051ddb88911e32fa19 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 14:29:13 -0500 Subject: [PATCH 17/18] wip --- .github/workflows/2018-ruby.yaml | 1 + .github/workflows/2021-ruby.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/2018-ruby.yaml b/.github/workflows/2018-ruby.yaml index f3ab9e0..f2a78b0 100644 --- a/.github/workflows/2018-ruby.yaml +++ b/.github/workflows/2018-ruby.yaml @@ -26,5 +26,6 @@ jobs: with: ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }} bundler-cache: true + working-directory: ./2018/ruby - name: Run tests run: bundle exec rspec diff --git a/.github/workflows/2021-ruby.yaml b/.github/workflows/2021-ruby.yaml index e3ad965..9231707 100644 --- a/.github/workflows/2021-ruby.yaml +++ b/.github/workflows/2021-ruby.yaml @@ -26,5 +26,6 @@ jobs: with: ruby-version: ${{ steps.determine-ruby-version.outputs.VERSION }} bundler-cache: true + working-directory: ./2021/ruby - name: Run tests run: bundle exec rspec From c354e30279604eda545cb98e28cbd20730c10cc0 Mon Sep 17 00:00:00 2001 From: Matt McMahand Date: Thu, 5 Dec 2024 15:04:14 -0500 Subject: [PATCH 18/18] old tests cleaup --- 2018/ruby/spec/advent_03_spec.rb | 2 +- 2018/ruby/spec/advent_05_spec.rb | 4 ++-- 2018/ruby/spec/advent_06_spec.rb | 5 ++--- 2018/ruby/spec/advent_07_spec.rb | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/2018/ruby/spec/advent_03_spec.rb b/2018/ruby/spec/advent_03_spec.rb index 073cebe..796e22b 100644 --- a/2018/ruby/spec/advent_03_spec.rb +++ b/2018/ruby/spec/advent_03_spec.rb @@ -29,7 +29,7 @@ expect(rectangle.width).to eq(4) end - it "solves the puzzle", solution: true do + it "solves the puzzle", solution: true, slow: true do reader = ClaimReader.new(puzzle_input) claims = reader.process diff --git a/2018/ruby/spec/advent_05_spec.rb b/2018/ruby/spec/advent_05_spec.rb index 7a3c45c..caac678 100644 --- a/2018/ruby/spec/advent_05_spec.rb +++ b/2018/ruby/spec/advent_05_spec.rb @@ -24,7 +24,7 @@ end end - xit "solves part 1" do + it "solves part 1", slow: true do reader = AlchemicalReduction.new(puzzle_input) reader.process @@ -55,7 +55,7 @@ expect(lowest[1]).to eq(4) end - xit "solves part 2" do + it "solves part 2", slow: true do counts = {} ('a'..'z').each do |letter| diff --git a/2018/ruby/spec/advent_06_spec.rb b/2018/ruby/spec/advent_06_spec.rb index f33941b..107760d 100644 --- a/2018/ruby/spec/advent_06_spec.rb +++ b/2018/ruby/spec/advent_06_spec.rb @@ -30,18 +30,17 @@ expect(c.largest_area).to eq(17) end - xit "solves part 1" do + it "solves part 1", slow: true do coordinates = puzzle_input.collect do |item| Coordinate.new(item[0], item[1]) end c = ChronalCoordinates.new(coordinates) - # c.print_grid expect(c.largest_area).to eq(3401) end - it "solves part 2" do + it "solves part 2", slow: true do coordinates = puzzle_input.collect do |item| Coordinate.new(item[0], item[1]) end diff --git a/2018/ruby/spec/advent_07_spec.rb b/2018/ruby/spec/advent_07_spec.rb index 4e5dfe9..3a0a584 100644 --- a/2018/ruby/spec/advent_07_spec.rb +++ b/2018/ruby/spec/advent_07_spec.rb @@ -58,7 +58,7 @@ def create_graph(input, weighted = false, seed_weight = 0) expect(orderer.compressed_order).to eq("CABDFE") end - xit "figures out the puzzle order" do + it "figures out the puzzle order", slow: true do graph = create_graph(puzzle_input) orderer = Orderer.new(graph) @@ -76,7 +76,7 @@ def create_graph(input, weighted = false, seed_weight = 0) expect(seconds).to eq(15) end - xit "figures out part 2 puzzle order" do + it "figures out part 2 puzzle order", slow: true do graph = create_graph(puzzle_input, true, 60) orderer = Orderer.new(graph)