mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-21 23:00:43 -08:00
Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment. This change fixes that.
This commit is contained in:
104
02_Amazing/pascal/object-pascal/amazingapplication.pas
Normal file
104
02_Amazing/pascal/object-pascal/amazingapplication.pas
Normal file
@@ -0,0 +1,104 @@
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user