{
    This file is part of Langton's Ant
    Copyright (c) 2002 by Ian Hickson

    Different scenarios involving Langton's Ant

    See the file COPYING, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
{$MODE OBJFPC}
unit Scenarios;

interface

uses
   LangtonAnt;

    function RunLangtonsAnt(aAntFarm: TAntFarm): Integer;
    function RunDoubleLangtonsAnt(aAntFarm: TAntFarm): Integer;

implementation

    function RunLangtonsAnt(aAntFarm: TAntFarm): Integer;
    var
       Ant: TAnt;
    begin
       Result := 0;
       with aAntFarm do
       begin
          Ant := NewAnt(Width div 2, Height div 2);
          with Ant do
          begin
             repeat
                Step;
                Inc(Result);
             until Stop;
             Free;
          end;
       end;
    end;

    function RunDoubleLangtonsAnt(aAntFarm: TAntFarm): Integer;
    var
       Ant1, Ant2: TAnt;
    begin
       Result := 0;
       with aAntFarm do
       begin
          Ant1 := aAntFarm.NewAnt(3 * Width div 4, Height div 2);
          Ant2 := aAntFarm.NewAnt(1 * Width div 4, Height div 2);
          repeat
             Ant1.Step;
             Ant2.Step;
             Inc(Result);
          until Stop;
          Ant1.Free;
          Ant2.Free;
       end;
    end;

end.

