Главная    Почта    Новости    Каталог    Одноклассники    Погода    Работа    Игры     Рефераты     Карты
  
по Казнету new!
по каталогу
в рефератах

Программа Клон

---------------------------------------------
-------
    //Возвращение рисунка для синих фишек
        if (a[i,j]=0) then
         if button=mbLeft then
          begin
           if (abs(i-vi)<3) and (abs(j-vj)<3) then
           begin
            if (abs(i-vi)=2) or (abs(j-vj)=2) then
            begin
             a[vi,vj]:=0;
             image2.Canvas.StretchDraw(b[vi,vj],image5.picture.bitmap);
             image2.Canvas.StretchDraw(b[i,j],image1.picture.bitmap);
             a[i,j]:=1; vi:=255;vj:=255;
            end
           else
            begin
               image2.Canvas.StretchDraw(b[i,j],image1.picture.bitmap);
               if (vi<>255)and (vj<>255)  then

      begin

            image2.Canvas.StretchDraw(b[vi,vj],image1.picture.bitmap);
                 vi:=255; vj:=255;
                end;
                 a[i,j]:=1;
            end;
            for ai:=i-1 to i+1 do //проверка близлежащих фишек КРАСНЫХ
              for aj:=j-1 to j+1 do
                if (ai>=0) and (aj>=0)and (ai<=9) and(aj<=9) then
                  if a[ai,aj]=2 then
                   begin
                    a[ai,aj]:=1;

image2.Canvas.StretchDraw(b[ai,aj],image1.picture.bitmap);
                    beep;
                   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)or(a[m,n]=0)then
                          kol:=kol+1;
                        end;
                        if kol=100 then
                        form4.show;
                        m:=0;n:=0;kol:=0;
                   end;hod:=false;//теперь красные
             end;
          end;
    END;
    //----------------------------------------------------------------------
---------
    //При нажатии активна красная (правая клавиша)
      if hod=false then
    BEGIN
       if a[i,j]=2 then
        begin
         if button=mbright then
          begin
           image2.Canvas.StretchDraw(b[i,j],image4.picture.bitmap);
             V2i:=i;
             v2j:=j;
          end
         else
          begin
           image2.Canvas.StretchDraw(b[v2i,v2j],image3.picture.bitmap);
          end;
         end;
    //----------------------------------------------------------------------
-------
    //Возвращение рисунка для красных фишек


    if (a[i,j]=0) then
         if button=mbright then
         begin
          if (abs(i-v2i)<3) and (abs(j-v2j)<3) then
          begin
            if(abs(i-v2i)=2) or (abs(j-v2j)=2) then
             begin
               a[v2i,v2j]:=0;
               image2.Canvas.StretchDraw(b[v2i,v2j],image5.picture.bitmap);
               image2.Canvas.StretchDraw(b[i,j],image3.picture.bitmap);
               a[i,j]:=2; v2i:=255; v2j:=255;
             end
             else
               begin
                  image2.Canvas.StretchDraw(b[i,j],image3.picture.bitmap);
                  if (v2i<>255)and(v2j<>255) then
                   begin

image2.Canvas.StretchDraw(b[v2i,v2j],image3.picture.bitmap);
                    v2i:=255; v2j:=255;
                   end;
                end;
                    a[i,j]:=2;
                 for a2i:=i-1 to i+1 do //проверка близлежащих фишек СИНИХ
                  for a2j:=j-1 to j+1 do
                   if (a2i>=0)and(a2j>=0)and(a2i<=9)and(a2j<=9) then
                     if a[a2i,a2j]=1 then
                      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.

1234
скачать работу

Программа Клон

 

Отправка СМС бесплатно

На правах рекламы


ZERO.kz
 
Модератор сайта RESURS.KZ