1
0
Fork 0

Part 2 that will never finish

This commit is contained in:
Andrew Tomaka 2024-12-24 01:09:59 -05:00
parent 592f73f68b
commit f4b1c9ac1e
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -281,25 +281,34 @@ directional_map = {
[">", "v"]=>["<"] [">", "v"]=>["<"]
} }
robot_1 = input @robot_1 = input
robot_2 = robot_1 @robot_2 = @robot_1
.map { ["A"] + _1 } .map { ["A"] + _1 }
.map { _1.each_cons(2).to_a } .map { _1.each_cons(2).to_a }
.map { _1.map { |move| numeric_map[move].first }.join("A") } .map { _1.map { |move| numeric_map[move].first }.join("A") }
.map { _1 + "A" } .map { _1 + "A" }
robot_3 = robot_2 (3..25).each do |num|
.map { _1.chars } puts "Robot #{num}"
.map { ["A"] + _1 } prev_robot = instance_variable_get(:"@robot_#{num - 1}")
.map { _1.each_cons(2).to_a }
.map do
_1.map do |move|
directional_map[move].nil? ? "" : directional_map[move].first
end.join("A")
end
.map { _1 + "A" }
me = robot_3 robot = prev_robot
.map { _1.chars }
.map { ["A"] + _1 }
.map { _1.each_cons(2).to_a }
.map do
_1.map do |move|
directional_map[move].nil? ? "" : directional_map[move].first
end.join("A")
end
.map { _1 + "A" }
instance_variable_set(:"@robot_#{num}", robot)
@last_num = num
end
last_robot = instance_variable_get(:"@robot_#{@last_num}")
me = last_robot
.map { _1.chars } .map { _1.chars }
.map { ["A"] + _1 } .map { ["A"] + _1 }
.map { _1.each_cons(2).to_a } .map { _1.each_cons(2).to_a }
@ -315,12 +324,6 @@ me.each_with_index do |entry, i|
end end
p me.map.with_index { |entry, i| entry.length * input[i].join.to_i }.sum p me.map.with_index { |entry, i| entry.length * input[i].join.to_i }.sum
puts me.first
puts robot_3.first
puts robot_2.first
puts robot_1.first.join
__END__ __END__
029A 029A
980A 980A