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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
| unit Game;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons;
type
TForm2 = class(TForm)
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2; pl:boolean;
implementation
uses Main, Over;
{$R *.dfm}
//ïðîöåäóðà ïåðåâ³ðêè ïåðåìîæöÿ
procedure over(pl: boolean);
begin
//ïåðåâ³ðêà ïåðåìîæöÿ òà âèçíà÷åííÿ íàäïèñó
if pl=true then Form3.Label1.Caption:=' Âè ïðîãðàëè:('
else Form3.Label1.Caption:='ÂÈ ÏÅÐÅÌÎÃËÈ!!!';
Form2.Visible:=False;
Form2.Enabled:=False;//â³êíî ãðè çíèêàº
Form3.Enabled:=True;
Form3.Visible:=True;//ç'ÿâëÿºòüñÿ â³êíî çàâåðøåííÿ
end;
//ïðîöåäóðà õîäó êîìï'þòåðà
procedure cpu(var pl:boolean);
var x:integer; label l;
begin
//ïåðåâ³ðêà, ÷è çàëèøèëèñü ùå êàì³íö³
if (Form2.SpeedButton1.visible=false) and
(Form2.SpeedButton2.visible=false) and
(Form2.SpeedButton3.visible=false) and
(Form2.SpeedButton4.visible=false) and
(Form2.SpeedButton5.visible=false) and
(Form2.SpeedButton6.visible=false) and
(Form2.SpeedButton7.visible=false) and
(Form2.SpeedButton8.visible=false) and
(Form2.SpeedButton9.visible=false) then
//ÿêùî í³, âèçíà÷àºìî ïåðåìîæöÿ
over(pl) else
//ÿêùî çàëèøèëèñÿ, êîìï'þòåð õîäèòü
begin
sleep(120);//çàòðèìêà äëÿ âèäèìîñò³ õîäó êîìï'þòåðà
pl:=not pl;//çì³íà ãðàâöÿ
//ïåðåâ³ðêà, ÿêùî çàëèøàºòüñÿ îäíà ñòðîêà êàì³íö³â, êîìï'þòåð çàáèðຠâñ³ â çàëèøèâø³éñÿ, òàêèì ÷èíîì, îòðèìóº ïåðåìîãó
if (Form2.SpeedButton1.visible=false) and (Form2.SpeedButton3.visible=false) then
begin
Form2.SpeedButton6.visible:=false;
Form2.SpeedButton7.visible:=false;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
end;
if (Form2.SpeedButton1.visible=false) and (Form2.SpeedButton6.visible=false) then
begin
Form2.SpeedButton3.visible:=false;
Form2.SpeedButton4.visible:=false;
Form2.SpeedButton5.visible:=false;
end;
if (Form2.SpeedButton3.visible=false) and (Form2.SpeedButton6.visible=false) then
begin
Form2.SpeedButton1.visible:=false;
Form2.SpeedButton2.visible:=false;
end;
if (Form2.SpeedButton1.visible=false) and
(Form2.SpeedButton2.visible=false) and
(Form2.SpeedButton3.visible=false) and
(Form2.SpeedButton4.visible=false) and
(Form2.SpeedButton5.visible=false) and
(Form2.SpeedButton6.visible=false) and
(Form2.SpeedButton7.visible=false) and
(Form2.SpeedButton8.visible=false) and
(Form2.SpeedButton9.visible=false) then over(pl) else
//â ³íàêøîìó âèïàäêó êîìï'þòåð íà îñíîâ³ âèïàäêîâîñò³ ðîáèòü ñâ³é õ³ä
begin
randomize;
l:
x:=random(9);
case x of
0: if Form2.SpeedButton1.visible=true then
begin
Form2.SpeedButton1.visible:=false;
Form2.SpeedButton2.visible:=false;
end else goto l;
1: if Form2.SpeedButton2.visible=true then
begin
Form2.SpeedButton2.visible:=false;
end else goto l;
2: if Form2.SpeedButton3.visible=true then
begin
Form2.SpeedButton3.visible:=false;
Form2.SpeedButton4.visible:=false;
Form2.SpeedButton5.visible:=false;
end else goto l;
3: if Form2.SpeedButton4.visible=true then
begin
Form2.SpeedButton4.visible:=false;
Form2.SpeedButton5.visible:=false;
end else goto l;
4: if Form2.SpeedButton5.visible=true then
begin
Form2.SpeedButton5.visible:=false;
end else goto l;
5: if Form2.SpeedButton6.visible=true then
begin
Form2.SpeedButton6.visible:=false;
Form2.SpeedButton7.visible:=false;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
end else goto l;
6: if Form2.SpeedButton7.visible=true then
begin
Form2.SpeedButton7.visible:=false;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
end else goto l;
7: if Form2.SpeedButton8.visible=true then
begin
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
end else goto l;
8: if Form2.SpeedButton9.visible=true then
begin
Form2.SpeedButton9.visible:=false;
end else goto l;
end;
end;
end;
end;
//Çà÷èíåííÿ â³êíà
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form1.Enabled:=true;
Form1.Visible:=true;
end;
//Äàë³ ³äóòü ïðîöåäóðè íàòèñíåííÿ íà êàì³íö³. Ïðè íàòèñíåíí³ íà áóäü-ÿêèé
//êàì³íåöü, âñ³ êàì³íö³ â ðÿäêó ñïðàâà â³ä íüîãî òà â³í ñàì çíèêàþòü
//Òàêîæ ï³ñëÿ êîæíîãî íàòèñíåííÿ âèêëèêàºòüñÿ õ³ä êîìï'þòåðà
procedure TForm2.SpeedButton2Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton2.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton1Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton1.visible:=false;
Form2.SpeedButton2.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton5Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton5.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton4Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton4.visible:=false;
Form2.SpeedButton5.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton3Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton3.visible:=false;
Form2.SpeedButton4.visible:=false;
Form2.SpeedButton5.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton9Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton9.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton8Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton7Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton7.visible:=false;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
cpu(pl);
end;
procedure TForm2.SpeedButton6Click(Sender: TObject);
begin
pl:=not pl;
Form2.SpeedButton6.visible:=false;
Form2.SpeedButton7.visible:=false;
Form2.SpeedButton8.visible:=false;
Form2.SpeedButton9.visible:=false;
cpu(pl);
end;
end. |