Программа Клон
Информация - Компьютеры, программирование
Другие материалы по предмету Компьютеры, программирование
begin
a[a2i,a2j]:=2;
image2.Canvas.StretchDraw(b[a2i,a2j],image3.picture.bitmap);
beep;
end;
for m:=i-9 to i+9 do //проверка всего поля
for n:=j-9 to j+9 do
if (m>=0)and(n>=0)and(m<=9)and(n<=9) then
begin
if (a[m,n]=2)or(a[m,n]=0)then
kol:=kol+1;
end;
if kol=100 then
form3.show;
hod:=true;//теперь синие
end;
end;
END;
m:=0;n:=0;kol:=0;
//-----------------------------------------------------------------------------
//Прверка поля на наличие свободного места
for m:=i-9 to i+9 do //проверка всего поля
for n:=j-9 to j+9 do
if (m>=0)and(n>=0)and(m<=9)and(n<=9) then
begin
if (a[m,n]=1) then blue:=blue+1; //счет синих
if (a[m,n]=2) then red:=red+1; //счет красных
kol:=red+blue;
end;
if kol=100 then
form5.show;
m:=0;n:=0;kol:=0;
end;
//-----------------------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var i,j:byte;
begin
for i:=0 to 9 do
for j:=0 to 9 do
begin
image2.Canvas.StretchDraw(b[i,j],image5.picture.bitmap);
a[i,j]:=0;
end;
begin
image2.Canvas.StretchDraw(b[0,0],image1.picture.bitmap);
a[0,0]:=1;
image2.Canvas.StretchDraw(b[0,9],image3.picture.bitmap);
a[0,9]:=2;
image2.Canvas.StretchDraw(b[9,9],image1.picture.bitmap);
a[9,9]:=1;
image2.Canvas.StretchDraw(b[9,0],image3.picture.bitmap);
a[9,0]:=2;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
VAR I,J:BYTE;
begin
hod:=true;
for i:=0 to 9 do
for j:=0 to 9 do
begin
b[i,j].Left:=i*(image1.Width);
b[i,j].top:=j*(image1.Height);
b[i,j].Bottom:=b[i,j].Top+image1.Height;
b[i,j].Right:=b[i,j].Left+image1.Width
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
form2.show;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button1: TButton;
Label5: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
close;
end;
end.
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm3 = class(TForm)
Label1: TLabel;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
{$R *.dfm}
procedure TForm3.BitBtn1Click(Sender: TObject);
begin
close;
end;
end.
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm4 = class(TForm)
BitBtn1: TBitBtn;
Label1: TLabel;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
procedure TForm4.BitBtn1Click(Sender: TObject);
begin
close;
end;
end.
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids;
type
TForm5 = class(TForm)
Label1: TLabel;
Button1: TButton;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses unit1;
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
edit1.text:=inttostr(blue);
edit2.text:=inttostr(red);
end;
procedure TForm5.Button2Click(Sender: TObject);
begin
close;
end;
end.