Commit c7be3030 authored by Vury Leo's avatar Vury Leo

performance trune for tg cyber magician

parent c0e3f945
......@@ -3640,6 +3640,8 @@ end
function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_level,tuner_filter,non_tuner_race,non_tuner_level,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,level_mapper,hand_count_mapper,scheck,sgoalcheck,selected,index,state,prune_indexes)
dfs_calls = dfs_calls + 1
if state.tuner_count>tuner_max then return false end
if state.non_tuner_count>non_tuner_max then return false end
......@@ -3747,19 +3749,21 @@ function Synchro.CanCompleteSelection(candidates,target_level,tuner_race,tuner_l
local branch_state=Synchro.ApplyVariantState(
state,mc,diff,tuner_race,tuner_level,prune_tuner_filter,non_tuner_race,non_tuner_level,prune_non_tuner_filter,tc,prune_level,append_material_limit_filter
)
table.insert(selected,mc)
if Synchro.CanCompleteSelection(
candidates,target_level,
tuner_race,tuner_level,tuner_filter,
non_tuner_race,non_tuner_level,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck,sgoalcheck,
selected,index+1,branch_state,prune_indexes
) then
if branch_state~=nil then
table.insert(selected,mc)
if Synchro.CanCompleteSelection(
candidates,target_level,
tuner_race,tuner_level,tuner_filter,
non_tuner_race,non_tuner_level,non_tuner_filter,tc,
tuner_min,tuner_max,non_tuner_min,non_tuner_max,
level_mapper,hand_count_mapper,scheck,sgoalcheck,
selected,index+1,branch_state,prune_indexes
) then
table.remove(selected)
return true
end
table.remove(selected)
return true
end
table.remove(selected)
end
end
......@@ -4262,10 +4266,12 @@ function Synchro.BuildStatesFromSelection(selection,tuner_race,tuner_level,tuner
st,card,selected,tc,tuner_race,tuner_level,tuner_filter,non_tuner_race,non_tuner_level,non_tuner_filter
)) do
-- merge diff into full state
local new_state = Synchro.ApplyVariantState(
local new_state=Synchro.ApplyVariantState(
st,card,diff,tuner_race,tuner_level,tuner_filter,non_tuner_race,non_tuner_level,non_tuner_filter,tc,prune_level,append_material_limit_filter
)
table.insert(next_states,new_state)
if new_state~=nil then
table.insert(next_states,new_state)
end
end
end
......@@ -4517,8 +4523,18 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_level,tuner_fil
if append_material_limit_filter~=nil then
new_material_limit_filter=aux.AND(append_material_limit_filter,st.material_limit_filter)
end
local new_possible_sums=diff.possible_sums or possible_sums
--- return nil if new_possible_sums has zero valid sum
local empty=true
for k,v in pairs(new_possible_sums) do
empty=false
break
end
if empty then
return nil
end
return {
possible_sums=diff.possible_sums or possible_sums,
possible_sums=new_possible_sums,
tuner_count=st.tuner_count+tuner_inc,
non_tuner_count=st.non_tuner_count+non_tuner_inc,
level_mapper=diff.level_mapper or st.level_mapper,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment