From 8befd43b2b38be48609043ed414406268697f8cc Mon Sep 17 00:00:00 2001 From: Mau Magnaguagno Date: Sat, 9 Dec 2023 04:24:29 -0300 Subject: [PATCH] Fix subtasks index from 07d9257 --- Hypertension.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Hypertension.rb b/Hypertension.rb index a89fc75..252f99d 100644 --- a/Hypertension.rb +++ b/Hypertension.rb @@ -83,7 +83,7 @@ def planning(tasks, level = 0) puts "#{' ' * level.pred}#{method}(#{current_task.join(' ')})" if @debug # Every unification is tested __send__(method, *current_task) {|subtasks| - subtasks.each {|t| [(@index += 1 if @domain[t[0]]), t]} + subtasks.map! {|t| [(@index += 1 if @domain[t[0]]), t]} new_index = @index if plan = planning(subtasks.concat(tasks), level) @decomposition.unshift("#{index} #{task_name} #{current_task.join(' ')} -> #{method[task_name.size+1..-1]} #{(old_index+1..new_index).to_a.join(' ')}")