Files
basic-computer-games/02_Amazing/pascal/object-pascal/amazingapplication.pas
Chris Reuter d26dbf036a Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment.
This change fixes that.
2021-11-21 18:30:21 -05:00

105 lines
1.5 KiB
ObjectPascal

unit AmazingApplication;
{$IFDEF FPC}
{$mode ObjFPC}{$H+}
{$ENDIF}
interface
uses
Classes
, SysUtils
, Crt
, Maze
;
type
{ TAmazingApplication }
TAmazingApplication = class(TObject)
private
FMaze: TMaze;
procedure PrintGreeting;
procedure GetDimensions;
procedure BuildMaze;
procedure PrintMaze;
protected
public
constructor Create;
destructor Destroy; override;
procedure Run;
published
end;
implementation
{ TAmazingApplication }
procedure TAmazingApplication.PrintGreeting;
begin
WriteLN(' ':28, 'AMAZING PROGRAM');
WriteLN(' ':15, 'CREATIVE COMPUTING MORRISTOWN, NEW JERSEY');
WriteLN;
WriteLN;
WriteLN;
WriteLN;
end;
procedure TAmazingApplication.GetDimensions;
var
width: Integer;
length: Integer;
begin
repeat
Write('WHAT ARE YOUR WIDTH AND LENGTH (SPACE IN BETWEEN): ');
ReadLN(width, length);
if (width = 1) or (length = 1) then
begin
WriteLN('MEANINGLESS DIMENSIONS. TRY AGAIN.');
end;
until (width > 1) and (length > 1);
FMaze:= TMaze.Create(width, length);
WriteLN;
WriteLN;
WriteLN;
WriteLN;
end;
procedure TAmazingApplication.BuildMaze;
begin
FMaze.Build;
end;
procedure TAmazingApplication.PrintMaze;
begin
FMaze.Print;
WriteLN;
end;
constructor TAmazingApplication.Create;
begin
//
end;
destructor TAmazingApplication.Destroy;
begin
if Assigned(FMaze) then
begin
FMaze.Free;
end;
inherited Destroy;
end;
procedure TAmazingApplication.Run;
begin
//ClrScr;
PrintGreeting;
GetDimensions;
BuildMaze;
PrintMaze;
end;
end.