Finish 2012-11-07 16:00:00 UTC

Simple mean: stochastic

by Daniel Hamngren

Status: Passed
Results: 19245 (cyc: 4, node: 123)
CPU Time: 1.122
Score: 19245.4
Submitted at: 2012-11-02 12:06:57 UTC
Scored at: 2012-11-02 12:09:38 UTC

Current Rank: 1603rd (Highest: 45th )

Comments
Daniel Hamngren
02 Nov 2012
Added a bit of sweet sweet randomness.
Please login or create a profile.
Code
function xyOut = solver(a, xyIn, wts)

xy = xyIn + round(4*(rand(size(xyIn))-0.5));

for k = 1:5
    
    xy = 2*xy;
    for i = 1:length(xy)
        i;
        I = find(a(:,i));
        midPoint = round(sum(xy(I,:))/length(I));
        old = xy(i,:);
        xy(i,:) = midPoint;
        if sum((xy(i,1) == xy(:,1)).*(xy(i,2) == xy(:,2))) > 1
            xy(i,:) = old;
        end
        
    end
    
end

xyOut = xy;


end