-- Returns move depending of how other player
-- played last ten moves. Uses TitForTat.

function Logic1 return Move is
   NDef: Integer;
   if MN > 10 then
      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-2)=Cooperate)) then
               return Cooperate;
            else return TitForTat;
            end if;
         when others => return Cooperate;
      end case;
      return TitForTat;
   end if;
end Logic1;

Tillbaka till huvudsidan