-
Notifications
You must be signed in to change notification settings - Fork 0
/
mn.pas
executable file
·248 lines (223 loc) · 5.88 KB
/
mn.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
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
unit Mn;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ExtCtrls;
type
TOstrichForm = class(TForm)
FinishLine: TBevel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Start1: TButton;
Start2: TButton;
PhotoLabel: TLabel;
Strich1: TImage;
Strich2: TImage;
WinnerLabel: TLabel;
Strichbase1: TImage;
Strichbase2: TImage;
Strichbase3: TImage;
Label7: TLabel;
Label8: TLabel;
Button1: TButton;
Button2: TButton;
refreshing: TImage;
RefreshLabel: TLabel;
procedure Start1Click(Sender: TObject);
procedure Start2Click(Sender: TObject);
procedure igetit(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
thewinner,userwinner: integer;
procedure StartRace;
public
{ Public declarations }
end;
var
OstrichForm: TOstrichForm;
implementation
{$R *.DFM}
uses cheat, utils, about;
procedure TOstrichForm.Start1Click(Sender: TObject);
begin
if start1.tag = 0 then
begin
start1.tag := 1;
userwinner := 1;
StartRace;
start1.tag := 0;
end;
end;
procedure TOstrichForm.Start2Click(Sender: TObject);
begin
if start1.tag = 0 then
begin
start1.tag := 1;
userwinner := 2;
StartRace;
start1.tag := 0;
end;
end;
procedure TOstrichForm.StartRace;
var
o1,o2:integer;
vis:integer;
i, j: integer;
cheater: integer;
procedure SetVis(q1,q2:boolean);
begin
case vis of
0: begin
if q1 then Strich1.Picture := Strichbase1.Picture;
if q2 then Strich2.Picture := Strichbase1.Picture;
if q1 then CheatForm.SetImage(1, 1);
if q2 then CheatForm.SetImage(2, 1);
end;
1,3:begin
if q1 then Strich1.Picture := Strichbase2.Picture;
if q2 then strich2.picture := strichbase2.picture;
if q1 then CheatForm.SetImage(1, 2);
if q2 then CheatForm.SetImage(2, 2);
end;
2: begin
if q1 then strich1.picture := strichbase3.picture;
if q2 then strich2.picture := strichbase3.picture;
if q1 then CheatForm.SetImage(1, 3);
if q2 then CheatForm.SetImage(2, 3);
end;
end;
vis := (vis + 1) mod 4;
if photolabel.visible = false then
case cheater of
11: begin
CheatForm.SetImage(1, 4);
CheatForm.FlashCheat(1);
end;
22: begin
CheatForm.SetImage(2, 4);
CheatForm.FlashCheat(2);
end;
end;
end;
procedure SetPos;
begin
strich1.left := o1;
strich2.left := o2;
end;
begin
randomize;
strich1.top := 32;
strich2.top := 96;
o1 := 32;
o2 := 32;
vis := 0;
WinnerLabel.visible := false;
cheatform.winnerlabel.visible := false;
PhotoLabel.Visible := false;
CheatForm.Resetcam;
refreshlabel.visible := false;
while ((o1+32) < finishline.left) and
((o2+32) < finishline.left) do
begin
(* the beginning of
the great racing algorithm *)
o1 := o1 + random(5) + 1;
o2 := o2 + random(5) + 1;
cheater := random(200);
case cheater of
11: o1 := o1 + random(10);
22: o2 := o2 + random(10);
end;
SetPos;
SetVis(true,true);
Delay(50);
end;
if o1 = o2 then
thewinner := 3
else if (o1+32) >= finishline.left then
thewinner :=1
else
thewinner :=2;
if thewinner = 3 then
winnerlabel.caption := 'Winner: Tie!'
else if thewinner = userwinner then
winnerlabel.caption := 'Winner: You!'
else
winnerlabel.caption := 'Winner: Computer!';
cheatform.winnerlabel.caption := winnerlabel.caption;
for i := 1 to 5 do
begin
photolabel.visible := true;
cheatform.winnerlabel.visible := true;
Delay(150);
photolabel.visible := false;
cheatform.winnerlabel.visible := false;
Delay(150);
end;
photolabel.visible := true;
winnerlabel.visible := true;
cheatform.winnerlabel.visible := true;
(* cool down period for exhausted ostriches *)
while ((o1+32) < ostrichform.width) or
((o2+32) < ostrichform.width) do
begin
if (o1+32) < ostrichform.width then
o1 := o1 + 2
else
o1 := ostrichform.width - 32;
if (o2+32) < ostrichform.width then
o2 := o2 + 2
else
o2 := ostrichform.width - 32;
SetPos;
SetVis(true,true);
Delay(50);
end;
(* enjoy refreashing blue gatoraid *)
(* preliminary version *)
while (strich1.top+32) < strich2.top do
begin
strich1.top := strich1.top + 2;
SetVis(true,false);
delay(50);
end;
while (strich2.top+32) < refreshing.top do
begin
strich2.top := strich2.top + 2;
strich1.top := strich1.top + 2;
SetVis(true,true);
delay(50);
end;
(* enjoy drink *)
for i := 1 to 10 do
begin
for j := 1 to 3 do
begin
SetVis(true,true);
delay(50);
end;
refreshlabel.visible := true;
for j := 1 to 3 do
begin
SetVis(true,true);
delay(50);
end;
refreshlabel.visible := false;
end;
refreshlabel.visible := true;
end;
procedure TOstrichForm.igetit(Sender: TObject);
begin
AboutForm.Explode(left + button1.left, top + button1.top);
end;
procedure TOstrichForm.Button2Click(Sender: TObject);
begin
cheatform.height := 364;
visible := false;
end;
end.