![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Здраствуйте, Мастера!Проблема есть глобальная, с игрой... [Delphi, Windows]
Avenger © (2006-05-29 19:28:00)Проблема в замене label на image, т.к. я делаю карты на Делфях и сначала обозначения карт на labele написал...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit1: TEdit;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label12: TLabel;
Button4: TButton;
Label4: TLabel;
Label11: TLabel;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
sshet,i :integer;
cards :array[0..8] of integer;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button2Click(Sender: TObject);
begin
form2.ShowModal;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if (sshet>16)and(label1.Caption<>'')and(label2.Caption<>'')and(label3.Caption<>'') then exit;
{ *****generim o4ki***** }
i:=random(36);
case i of
0..3:i:=6;
4..7:i:=7;
8..11:i:=8;
12..15:i:=9;
16..19:i:=10;
{ Kartinki :))))))) }
20..23:i:=11;
24..27:i:=12;
28..31:i:=13;
32..35:i:=14;
end;
cards[i-6]:=cards[i-6]+1;
if label1.Caption='' then
begin
label1.Caption:=inttostr(i);
end
else
if label2.Caption='' then
begin
label2.Caption:=inttostr(i);
end
else
if label3.Caption='' then
begin
label3.Caption:=inttostr(i);
end;
if (i>10) and (i<14) then
i:=10;
sshet:=sshet+i;
if i=14 then sshet:=sshet+1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
randomize;
sshet:=0;
for i:=0 to 3 do cards[i]:=0;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
label6.Caption:=inttostr(strtoint(label6.caption)+2*strtoint(edit1.Text));
Edit1.Text:='0';
label1.Caption:='';
label2.Caption:='';
label3.Caption:='';
sshet:=0;
for i:=0 to 8 do cards[i]:=0;
end;
procedure TForm1.Button4Click(Sender: TObject);
var
j,sshet1:integer;
label goto1;
begin
if button4.Caption='ещё сыграть' then
begin
button4.Caption:='раскрыться';
button1.Enabled:=true;
button2.Enabled:=true;
button3.Enabled:=true;
label1.Caption:='';
label2.Caption:='';
label3.Caption:='';
label9.Caption:='';
label12.Caption:='';
label10.Caption:='';
sshet1:=0;
sshet:=0;
exit;
end;
sshet1:=0;
for j:=0 to 2 do
begin
if (sshet1>=15) then break;
i:=random(36);
goto1:
case i of
0..3:i:=6;
4..7:i:=7;
8..11:i:=8;
12..15:i:=9;
16..19:i:=10;
20..23:i:=11;
24..27:i:=12;
28..31:i:=13;
32..35:i:=14;
end;
if cards[i-6]>=4 then goto goto1;
if label9.Caption='' then
begin
label9.Caption:=inttostr(i);
end
else
if label12.Caption='' then
begin
label12.Caption:=inttostr(i);
end
else
if label10.Caption='' then
begin
label10.Caption:=inttostr(i);
end;
if (i<14) and (i>10) then i:=10;
sshet1:=sshet1+i;
if i=14 then sshet1:=sshet1+1;
end;
label4.Caption:=inttostr(sshet1);
label11.Caption:=inttostr(sshet);
{ ******analiz****** }
button4.Caption:='ещё сыграть';
button1.Enabled:=false;
button2.Enabled:=false;
button3.Enabled:=false;
for i:=0 to 8 do cards[i]:=0;
if ((sshet>sshet1)and(sshet<=21)) or ((sshet1>sshet)and(sshet1<=21)) then
begin
showmessage('юзер выйграл);
form1.Label5.Caption:=inttostr(strtoint(form1.Label5.Caption)+2*strtoint(form1.Edit1.text));
form1.edit1.Text:='0';
end
else
begin
showmessage('компутер проиграл');
form1.Label6.Caption:=inttostr(strtoint(form1.Label6.Caption)+2*strtoint(form1.Edit1.text));
form1.edit1.Text:='0';
end;
if sshet=0 then
showmessage ('вы проиграли всё');
end;
end.
Заранее огромное спасибо...
RzCoDer (2006-05-30 12:02:00) [21]скажи по русски чего надо сделать то?