Class TPileForm (unit SandShow) |
Inherits from
TForm
Methods for visualizing the sandpile
procedure DrawGridDrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
procedure FormCreate(Sender: TObject);
--------------------- TPileForm ----------------------
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure QuickDrawCell(X, Y: Integer);
Fill the cell with the right color
procedure SetGridSize;
procedure TPileForm.
procedure UndrawTrace;
Use trace color
DrawGrid : TDrawGrid;
GridSize : Byte;
TracedCells : TQueue;
# cells in grid (horiz.
procedure DrawGridDrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
procedure FormCreate(Sender: TObject);
--------------------- TPileForm ----------------------
procedure FormDestroy(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure QuickDrawCell(X, Y: Integer);
Fill the cell with the right color
procedure SetGridSize;
procedure TPileForm.ClearCells;
// Clears all cells in the drawing grid
var
I, J: Longint;
begin
with Grid do
begin
Canvas.Brush.Color := clWindow;
Canvas.FillRect(ClientRect);
{ for I := 0 to ColCount -1 do
for J := 0 to RowCount -1 do
Canvas.FillRect(CellRect(I,J)); // Fill the cell }
end;
end;
procedure UndrawTrace;
Use trace color
DrawGrid : TDrawGrid;
GridSize : Byte;
TracedCells : TQueue;
# cells in grid (horiz. and vert.