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,14 +281,18 @@ directional_map = {
[">", "v"]=>["<"]
}
robot_1 = input
robot_2 = robot_1
@robot_1 = input
@robot_2 = @robot_1
.map { ["A"] + _1 }
.map { _1.each_cons(2).to_a }
.map { _1.map { |move| numeric_map[move].first }.join("A") }
.map { _1 + "A" }
robot_3 = robot_2
(3..25).each do |num|
puts "Robot #{num}"
prev_robot = instance_variable_get(:"@robot_#{num - 1}")
robot = prev_robot
.map { _1.chars }
.map { ["A"] + _1 }
.map { _1.each_cons(2).to_a }
@ -298,8 +302,13 @@ robot_3 = robot_2
end.join("A")
end
.map { _1 + "A" }
instance_variable_set(:"@robot_#{num}", robot)
me = robot_3
@last_num = num
end
last_robot = instance_variable_get(:"@robot_#{@last_num}")
me = last_robot
.map { _1.chars }
.map { ["A"] + _1 }
.map { _1.each_cons(2).to_a }
@ -315,12 +324,6 @@ me.each_with_index do |entry, i|
end
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__
029A
980A