Logic2.adb
-- Returns move defending of other players
-- last 10 moves. Cooperates a lot.
function Logic2 return Move is
NDef: Integer;
begin
if MN > 10 then
NDef:=0;
for I in MN-10..MN-1 loop
if(OppMoves(I)=Defect) then NDef:=NDef+1; end if;
end loop;
case NDef is
when 9..10 => return Defect;
when 6..8 =>
if OppMoves(MN-1)=Defect then
return Defect;
else return Cooperate;
end if;
when 3..5 =>
if ((OppMoves(MN-1)=Cooperate)
and (OppMoves(MN-1)=Cooperate)) then
return Cooperate;
else return Cooperate;
end if;
when others => return Cooperate;
end case;
else
return TitForTat;
end if;
end Logic2;
Tillbaka till huvudsidan