Files
basic-computer-games/02 Amazing/pascal/object-pascal/room.pas
Gustavo Carreno 212a1c292d Adding port of 02 Amazing to pascal object-pascal
Adding complete implementation of 02 Amazing in Object-Pascal
2021-03-05 17:25:46 +00:00

72 lines
827 B
ObjectPascal

unit Room;
{$IFDEF FPC}
{$mode ObjFPC}{$H+}
{$ENDIF}
interface
uses
Classes
, SysUtils
;
type
{ TRoom }
TRoom = class(TObject)
private
FVisited: Integer;
FWalls: Integer;
protected
public
constructor Create;
procedure PrintRoom;
procedure PrintWall;
property Visited: Integer
read FVisited
write FVisited;
property Walls: Integer
read FWalls
write FWalls;
published
end;
implementation
{ TRoom }
constructor TRoom.Create;
begin
FVisited:= 0;
FWalls:= 0;
end;
procedure TRoom.PrintRoom;
begin
if FWalls < 2 then
begin
Write(' I');
end
else
begin
Write(' ');
end;
end;
procedure TRoom.PrintWall;
begin
if (FWalls = 0) or (FWalls = 2) then
begin
Write(':--');
end
else
begin
Write(': ');
end;
end;
end.