Code: Alles auswählen
type
TOperation=class(TBoard) //TBoard ist ein komplexes Datenobjekt mit ein paar Funktionen
private
public
constructor Create();
class(TThread) procedure Run;
end;
TBestMove=record
x,y,z : byte;
Value : word;
end;
TBruteForce=class
private
FBestMove : TBestMove;
FProcessing : TList;
published
public
constructor Create;
destructor Destroy; override;
function ComputeMove(const PlaceBestMove:boolean): Word;
end;
function TBruteForce.ComputeMove(const PlaceBestMove: boolean): Word;
begin
for to do FProcessing.Add(TOperation.Create);
while FProcessing.Count>0 do
begin
FProcessing.Run;
end;
PlaceBestMove;
end;
procedure TThread.Execute;
var Value:word;
s:string;
begin
s:=Operation(<FProcessing.Data>);
Value:=Operation2(s);
if Value>BestMove then BestMove:=FProcessing.Data;
end;
TIA, Scotty.