Winner David (Rogue Ant 4)

2008-11-12 12:00:00 UTC

# Queue test 3

Status: Passed
Results: 8149.05 (cyc: 22, node: 741)
CPU Time: 62.2581
Score: 8168.14
Submitted at: 2008-11-08 00:19:55 UTC
Scored at: 2008-11-08 00:22:14 UTC

Current Rank: 99th
Basis for: CCat24 (diff)

Alan Chalker
08 Nov 2008
Lets see how this works
Code
```function [dRow,dCol,action,mark] = solver(mainMap,foodMap,myAntMap,opAntMap, ...
myScentMap,opScentMap,myDeathMap,opDeathMap)

end;
end;
end;
end;
end;
end;
end;
end;

% decide scent
Y = [7 8 9 12 13 14 17 18 19];
myScent = myScentMap(13);
if (mainMap(13) == 1)
mark = 100;
else
mark = floor((max(myScentMap(Y))-myScent-1)/myAntMap(13));
end;
H = mainMap == 1;
myScentMap(H) = inf;

% fight if challenged
if (any(opAntMap(Y)))
action = -1;
if (sum(myAntMap(:))<8)||(rand < 0.5)
dRow = 0;
dCol = 0;
return
else
[r,c] = find(opAntMap(2:4,2:4)&~opAntMap(4:-1:2,4:-1:2));
if isempty(r)
dRow = 0;
dCol = 0;
return
end;
end;
end;

% look for food
action = 0;
foodMap(H) = 0;
netFood = foodMap-myAntMap;
netFood(H) = 0;
if (foodMap(13) > 0)&&(rand > (myAntMap(13)-foodMap(13))/myAntMap(13))
lowFood = (netFood>0)&(myScentMap<myScent);
hiFood = (netFood>0)&(myScentMap>myScent);
myFood = foodMap(13);
if ~any(lowFood(:))||((foodMap(13) > 1)&&(rand > sqrt(1/foodMap(13))))
% carry home
action = 1;
myScentMap(13) = -inf;
maxScent = max(myScentMap(:));
if (maxScent == 0)
mainMap(13) = nan;
[r,c] = find(~isnan(mainMap(2:4,2:4)));
pick = ceil(rand*numel(r));
dRow = sign(r(pick)-2);
dCol = sign(c(pick)-2);
else
[r,c] = find(myScentMap==maxScent);
dRow = sign(r(1)-3);
dCol = sign(c(1)-3);
end;
else
% gather lower
bottomFood = min(myScentMap(lowFood>0));
[r,c] = find((lowFood>0)&(myScentMap==bottomFood));
dRow = sign(r(1)-3);
dCol = sign(c(1)-3);
end;
elseif (any(netFood(:) > 0))
% gather
bottomFood = min(myScentMap(netFood>0));
[r,c] = find((netFood>0)&(myScentMap==bottomFood));
%[r,c] = find(netFood==max(netFood(:)));
dRow = sign(r(1)-3);
dCol = sign(c(1)-3);
else
% explore
if (rand>.9)
mainMap(13) = nan;
[r,c] = find(~isnan(mainMap(2:4,2:4)));
pick = ceil(rand*numel(r));
dRow = sign(r(pick)-2);
dCol = sign(c(pick)-2);
else