diff --git a/UCommon.pas b/UCommon.pas index 0e674d9..bae26e7 100644 --- a/UCommon.pas +++ b/UCommon.pas @@ -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; + TPoints = specialize TList; + implementation end. diff --git a/solvers/UCosmicExpansion.pas b/solvers/UCosmicExpansion.pas index 5f77003..7919ca6 100644 --- a/solvers/UCosmicExpansion.pas +++ b/solvers/UCosmicExpansion.pas @@ -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; - FGalaxies: specialize TList; + 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.Create; - FRowExpansion := specialize TList.Create; - FGalaxies := specialize TList.Create; + FColumnExpansion := TIntegerList.Create; + FRowExpansion := TIntegerList.Create; + FGalaxies := TPoints.Create; end; destructor TCosmicExpansion.Destroy; diff --git a/solvers/ULongWalk.pas b/solvers/ULongWalk.pas index 4af7fb5..e66e5ca 100644 --- a/solvers/ULongWalk.pas +++ b/solvers/ULongWalk.pas @@ -25,8 +25,6 @@ uses Classes, SysUtils, Generics.Collections, USolver, UCommon; type - TPoints = specialize TList; - TCrossing = class; { TPath } diff --git a/solvers/UStepCounter.pas b/solvers/UStepCounter.pas index 6227d12..0a22c10 100644 --- a/solvers/UStepCounter.pas +++ b/solvers/UStepCounter.pas @@ -25,7 +25,6 @@ uses Classes, SysUtils, Generics.Collections, USolver, UCommon; type - TPoints = specialize TList; { TStepCounter }