-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUDebug.pas
More file actions
62 lines (53 loc) · 1.73 KB
/
Copy pathUDebug.pas
File metadata and controls
62 lines (53 loc) · 1.73 KB
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 UDebug;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, UUtility, UGameGrid;
type
TDebugForm = class(TForm)
memDebug: TMemo;
private
{ Private declarations }
public
procedure ShowDebug(GameGrid:TGameGridClass; n: integer);
end;
var
DebugForm: TDebugForm;
implementation
uses StrUtils;
{$R *.dfm}
{ TDebugForm }
procedure TDebugForm.ShowDebug(GameGrid:TGameGridClass; n: integer);
const cspc = ' . ';
var s: string;
m, f, c: integer;
begin
memDebug.Clear;
m := 0; f := 0; c := 0;
for var y: integer := 0 to GameGrid.FGridData.Height - 1 do
begin
s := '';
for var x: integer := 0 to GameGrid.FGridData.Width - 1 do
begin
case n of
0: s := s + IfThen(GameGrid.MineField[x, y].Flag, '[F]', cspc);
1: s := s + IfThen(GameGrid.MineField[x, y].Mine, 'M', cspc);
2: s := s + IfThen(GameGrid.MineField[x, y].Covered, 'C', cspc);
3: s := s + IfThen(GameGrid.MineField[x, y].DownCheck, ' D ', cspc);
end;
if GameGrid.MineField[x, y].Flag then inc(f);
if GameGrid.MineField[x, y].Mine then inc(m);
if GameGrid.MineField[x, y].Covered then inc(c);
//s := s + IfThen(GameGrid.MineField[x, y].Flag, '[', '.');
//s := s + IfThen(GameGrid.MineField[x, y].Mine, 'M', cspc);
//s := s + IfThen(GameGrid.MineField[x, y].Covered, ']', ',');
end;
memDebug.Lines.Add(s);
end;
memDebug.Lines.Add('');
memDebug.Lines.Add(format('Mines: %d', [m]));
memDebug.Lines.Add(format('Flags: %d', [f]));
memDebug.Lines.Add(format('Cover: %d', [c]));
show;
end;
end.