Pattern2.adb

-- Find patterns with 5 moves
-- If no pattern or not more than 11 moves
-- play TitForTat

function Pattern2 return Move is
   Pattern: MoveRecord;
   I: Integer;
begin
   if MN > 11 then
      Pattern(1..5):=OppMoves(MN-5..MN-1);
      I:=MN-6;
      while(I > 0) loop
         if Pattern(1..5)=OppMoves(I..I+4) then
            return OppMoves(I+5);
         end if;
         I:=I-1;
      end loop;
      return TitForTat;
   else
      return TitForTat;
   end if;
end Pattern2;

Tillbaka till huvudsidan