Class TPile (unit Sandpile)

Inherits from

TObject

Max height and width for a sandpile

Constructors


constructor Create(SizeXY: Byte);

Applies to last round

---------------------- TPile -------------------------



Functions

procedure AddGrain(X, Y: Integer);

Clear the Grid array

function IsCritical(X, Y: Integer): Boolean;

No grains lost yet in this round

procedure Topple(X, Y: Integer; var Q: TQueue);

1 grain has fallen off the surface

function OnSurface(X, Y: Integer): Boolean;

Is local height > 4 ?

Properties

Events

Variables

DeltaLost : Longint;


DeltaToppled : Longint;

Applies to all rounds

GrainsAdded : Longint;

Size of sandpile as specified by user

GrainsLost : Longint;


GrainsToppled : Longint;


Grid : array[0..ArrayXY, 0..ArrayXY] of 0..8;


Size : Byte;

Zero-based array of grains The variables below ought to be read-only properties, but what the heck


Constructors


constructor Create(SizeXY: Byte);

Applies to last round

---------------------- TPile -------------------------


Functions


procedure AddGrain(X, Y: Integer);

Clear the Grid array


function IsCritical(X, Y: Integer): Boolean;

No grains lost yet in this round


procedure Topple(X, Y: Integer; var Q: TQueue);

1 grain has fallen off the surface


function OnSurface(X, Y: Integer): Boolean;

Is local height > 4 ?


Properties


Events


Variables


DeltaLost : Longint;


DeltaToppled : Longint;

Applies to all rounds


GrainsAdded : Longint;

Size of sandpile as specified by user


GrainsLost : Longint;


GrainsToppled : Longint;


Grid : array[0..ArrayXY, 0..ArrayXY] of 0..8;


Size : Byte;

Zero-based array of grains The variables below ought to be read-only properties, but what the heck