Pattern1.adb

-- Try to find patterns with length 10 moves
-- If no pattern play or not more then 20 moves
-- play TitForTat

function Pattern1 return Move is
   Pattern: MoveRecord;
   I: Integer;
begin
   if MN > 20 then
      Pattern(1..10):=OppMoves(MN-10..MN-1);
      I:=MN-11;
      while(I > 0) loop
         if Pattern(1..10)=OppMoves(I..I+9) then
            return OppMoves(I+10);
         end if;
         I:=I-1;
      end loop;
      return TitForTat;
   else
      return TitForTat;
   end if;
end Pattern1;

Tillbaka till huvudsidan