Profile
- Name
- Datacute Native Contact Map
- ID
- 44009
- Shared with
- Public
- Parent
- None
- Children
- Created on
- August 26, 2012 at 10:29 AM UTC
- Updated on
- August 26, 2012 at 10:29 AM UTC
- Description
Band and wiggle till the contact map is maximised
Best for
Code
function PushAndPull(portion)
local pushers = 0
local pullers = 0
for j=1,structure.GetCount() do
for i=j+3,structure.GetCount() do
local c = contactmap.IsContact(i,j)
local h = contactmap.GetHeat(i,j)
if c then
if h == 1 then
local b = band.AddBetweenSegments(i,j)
local bl = band.GetLength(b)
band.SetGoalLength(b,bl*(1+portion))
pushers = pushers + 1
end
else
if h == 0 then
local b = band.AddBetweenSegments(i,j)
local bl = band.GetLength(b)
band.SetGoalLength(b,bl/(1+portion))
pullers = pullers + 1
end
end
end
end
print("Pushing "..pushers.." and Pulling "..pullers)
return pushers + pullers
end
while PushAndPull(0.5) > 0 do
structure.WiggleAll(1)
end