mit pseudo kode forslag
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TCPoint=class
X:byte;
Y:byte;
constructor create(aX,aY:Byte);
end;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
constructor TCPoint.create(aX,aY:Byte);
begin
X:=aX;
Y:=aY;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
flist:TList;
fPoint:TCPoint;
i:integer;
begin
{create list}
flist:=TList.Create;
{for each move add the position of the put piece}
fPoint:=TCPoint.create(0,0);
{for undo aquire last move}
fPoint:=TCPoint(flist.Last);
{undo the move.}
{remove move from list}
flist.Remove(flist.Last);
{delete move}
fPoint.Free;
{when ending game clear list of all moves}
for i:=flist.Count downto 0 do
begin
fPoint:=TCPoint(flist.Last);
flist.Remove(flist.Last);
fPoint.Free;
end;
{delete the list.}
flist.Free;
end;
end.
-----------------------------------------------------------------------------
Min side ->www.the-hive.dk/~donp/