Icon representing a recipe

Recipe: Core_Rebuild_v1

created by Fasodankfds

Profile


Name
Core_Rebuild_v1
ID
109281
Shared with
Public
Parent
None
Children
None
Created on
December 14, 2025 at 10:01 AM UTC
Updated on
December 14, 2025 at 10:04 AM UTC
Description

Best for


Code


--[[ Simple Rebuild Test Recipe Tests basic rebuild functionality on a small segment ]]-- -- Get initial score local startScore = current.GetScore() print("Starting score: " .. string.format("%.2f", startScore)) -- Configuration local segmentStart = 10 -- Starting segment (adjust for your puzzle) local segmentEnd = 15 -- Ending segment local numRebuilds = 5 -- Number of rebuild attempts print("Testing rebuilds on segments " .. segmentStart .. "-" .. segmentEnd) -- Save initial position save.Quicksave(10) local bestScore = startScore -- Try multiple rebuilds for i = 1, numRebuilds do print("Rebuild attempt " .. i .. "...") -- Select the segment range selection.DeselectAll() selection.SelectRange(segmentStart, segmentEnd) -- Perform rebuild structure.RebuildSelected(1) -- Basic wiggle to settle behavior.SetClashImportance(1) structure.WiggleSelected(10) local newScore = current.GetScore() -- Save if better if newScore > bestScore then print(" Improved! Score: " .. string.format("%.2f", newScore) .. " (+" .. string.format("%.2f", newScore - bestScore) .. ")") save.Quicksave(10) bestScore = newScore else print(" No improvement: " .. string.format("%.2f", newScore)) -- Restore best position save.Quickload(10) end end -- Final wiggle on best result print("\nFinal optimization...") selection.SelectAll() structure.WiggleAll(20) local finalScore = current.GetScore() local totalGain = finalScore - startScore print("\n--- Results ---") print("Start: " .. string.format("%.2f", startScore)) print("Final: " .. string.format("%.2f", finalScore)) print("Gain: " .. string.format("%.2f", totalGain)) -- Save to slot 3 save.Quicksave(3) print("\nBest result saved to slot 3")

Comments