-
Notifications
You must be signed in to change notification settings - Fork 0
/
uBoard.pas
62 lines (48 loc) · 1.22 KB
/
uBoard.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
unit uBoard;
interface
uses
StrUtils, SysUtils, Dialogs, Classes, uTile, types;
type
TBoard = class
protected
FFreeParkingBal:integer;
function GetFreeParkingBal:integer;
procedure SetFreeParkingBal(v:integer);
public
//This array holds the 40 tiles that compose the physical board
tiles : array [0..39] of TTile;
constructor Create;
//This property enabled interaction with the Field FFreeParkingBal
property FreeParkingBal:integer read GetFreeParkingBal write SetFreeParkingBal;
end;
implementation
{ TBoard }
constructor TBoard.Create;
var
tilefile : textfile;
line : string;
tileinfo : TStringDynArray;
tilenum : integer;
begin
AssignFile(tilefile,'tiles.txt');
Reset(tilefile);
tilenum := 0;
while not(EOF(tilefile)) do
begin
readln(tilefile,line);
tileinfo := splitstring(line,',');
tiles[tilenum] := TTile.Create(tileinfo);
inc(tilenum);
end;
closefile(tilefile);
FFreeParkingBal := 0;
end;
function TBoard.GetFreeParkingBal: integer;
begin
result := FFreeParkingBal
end;
procedure TBoard.SetFreeParkingBal(v: integer);
begin
FFreeParkingBal := v;
end;
end.