Added TIntegerList and TPoints to common types

This commit is contained in:
Stefan Müller 2024-08-28 22:54:34 +02:00
parent 75aab50d42
commit b5576c66f1
4 changed files with 11 additions and 10 deletions

View File

@ -22,7 +22,7 @@ unit UCommon;
interface
uses
Classes, SysUtils;
Classes, SysUtils, Generics.Collections;
type
PPoint = ^TPoint;
@ -39,6 +39,10 @@ const
CDirectionLeftUp: TPoint = (X: -1; Y: -1);
CPCardinalDirections: array[0..3] of PPoint = (@CDirectionRight, @CDirectionDown, @CDirectionLeft, @CDirectionUp);
type
TIntegerList = specialize TList<Integer>;
TPoints = specialize TList<TPoint>;
implementation
end.

View File

@ -22,7 +22,7 @@ unit UCosmicExpansion;
interface
uses
Classes, SysUtils, Generics.Collections, Math, USolver;
Classes, SysUtils, Generics.Collections, Math, USolver, UCommon;
const
CGalaxyChar = '#';
@ -36,8 +36,8 @@ type
TCosmicExpansion = class(TSolver)
private
FExpansionFactor: Integer;
FColumnExpansion, FRowExpansion: specialize TList<Integer>;
FGalaxies: specialize TList<TPoint>;
FColumnExpansion, FRowExpansion: TIntegerList;
FGalaxies: TPoints;
procedure InitColumnExpansion(const ASize: Integer);
public
constructor Create(const AExpansionFactor: Integer = 999999);
@ -67,9 +67,9 @@ end;
constructor TCosmicExpansion.Create(const AExpansionFactor: Integer);
begin
FExpansionFactor := AExpansionFactor;
FColumnExpansion := specialize TList<Integer>.Create;
FRowExpansion := specialize TList<Integer>.Create;
FGalaxies := specialize TList<TPoint>.Create;
FColumnExpansion := TIntegerList.Create;
FRowExpansion := TIntegerList.Create;
FGalaxies := TPoints.Create;
end;
destructor TCosmicExpansion.Destroy;

View File

@ -25,8 +25,6 @@ uses
Classes, SysUtils, Generics.Collections, USolver, UCommon;
type
TPoints = specialize TList<TPoint>;
TCrossing = class;
{ TPath }

View File

@ -25,7 +25,6 @@ uses
Classes, SysUtils, Generics.Collections, USolver, UCommon;
type
TPoints = specialize TList<TPoint>;
{ TStepCounter }