Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit dodo;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, sButton;
- type
- TForm13 = class(TForm)
- Edit1: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Timer1: TTimer;
- Panel1: TPanel;
- Button1: TButton;
- Memo1: TMemo;
- sButton1: TsButton;
- Timer2: TTimer;
- Timer3: TTimer;
- procedure Timer1Timer(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure sButton1Click(Sender: TObject);
- procedure Timer2Timer(Sender: TObject);
- procedure Timer3Timer(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- type
- TMatrix = array of array of string;
- var
- Form13: TForm13;
- dat,dat2:TMatrix;
- implementation
- {$R *.dfm}
- function chek(dat:TMatrix):integer;
- var sum,x,y:integer; last:string;
- begin
- result:=0;
- sum:=0;
- for y := 1 to 6 do begin
- sum:=0; last:='qqqqq';
- for x := 3 to 6 do
- if (dat[x,y]<>dat[x-1,y]) or (dat[x,y]<>dat[x-2,y]) then sum:=0 else begin result:=x*10+y; break; end;
- end;
- for x := 1 to 6 do begin
- sum:=0; last:='qqqqq';
- for y := 3 to 6 do
- if (dat[x,y]<>dat[x,y-1]) or (dat[x,y]<>dat[x,y-2]) then sum:=0 else begin result:=x*10+y; break; end;
- end;
- end;
- procedure TForm13.Button1Click(Sender: TObject);
- var m,n,x,y:integer; buf:string; k1,k2:integer; need1,need2,need3,need4:integer;
- DC: HDC;
- item:string;
- color1:integer;
- bmp:TBitmap;
- begin
- m:=780;
- n:=350;
- DC:= GetWindowDC(0);
- bmp:=TBitmap.Create;
- bmp.Height:=Screen.Height;
- bmp.Width:=Screen.Width;
- DC:=GetDC(0);
- bitblt(bmp.Canvas.Handle, 0, 0, Screen.Width, Screen.Height,DC, 0, 0, SRCCOPY);
- for y:=0 to 5 do begin
- for x:=0 to 5 do begin
- //SetCursorPos(786+x*100, 350+y*100);
- //sleep(500);
- color1:=GetRValue(Bmp.Canvas.Pixels[m+x*100, n+y*100])*1000+GetGValue(Bmp.Canvas.Pixels[m+x*100, n+y*100])*100
- +GetBValue(Bmp.Canvas.Pixels[m+x*100, n+y*100]);
- item:=IntToStr(color1);
- case color1 of
- 34420:item:='носки';
- 274300:item:='дезик';
- 40434:item:='бритва';
- 253129:item:='шорты';
- 47533:item:='тапки';
- 263139:item:='шампунь';
- end;
- Memo1.Lines.Add(IntToStr(x+1)+' '+IntToStr(y+1)+' '+item);
- dat[x+1,y+1]:=item;
- end;
- end;
- for y := 1 to 6 do for x := 1 to 5 do begin
- for k1 := 1 to 6 do for k2 := 1 to 6 do dat2[k1,k2]:=dat[k1,k2];
- buf:=dat[x+1,y]; dat2[x,y]:=buf;
- buf:=dat[x,y]; dat2[x+1,y]:=buf;
- if (chek(dat2)<>0) then begin need1:=x; need2:=y; need3:=x+1; need4:=y; end;
- end;
- for y := 1 to 6 do for x := 2 to 6 do begin
- for k1 := 1 to 6 do for k2 := 1 to 6 do dat2[k1,k2]:=dat[k1,k2];
- buf:=dat[x-1,y]; dat2[x,y]:=buf;
- buf:=dat[x,y]; dat2[x-1,y]:=buf;
- if (chek(dat2)<>0) then begin need1:=x; need2:=y; need3:=x-1; need4:=y; end;
- end;
- for y := 2 to 6 do for x := 1 to 6 do begin
- for k1 := 1 to 6 do for k2 := 1 to 6 do dat2[k1,k2]:=dat[k1,k2];
- buf:=dat[x,y-1]; dat2[x,y]:=buf;
- buf:=dat[x,y]; dat2[x,y-1]:=buf;
- if (chek(dat2)<>0) then begin need1:=x; need2:=y; need3:=x; need4:=y-1; end;
- end;
- for y := 1 to 5 do for x := 1 to 6 do begin
- for k1 := 1 to 6 do for k2 := 1 to 6 do dat2[k1,k2]:=dat[k1,k2];
- buf:=dat[x,y+1]; dat2[x,y]:=buf;
- buf:=dat[x,y]; dat2[x,y+1]:=buf;
- if (chek(dat2)<>0) then begin need1:=x; need2:=y; need3:=x; need4:=y+1; end;
- end;
- SetCursorPos(786+(need1-1)*100, 350+(need2-1)*100); sleep(10);
- mouse_event(MOUSEEVENTF_LEFTDOWN,X,Y,0,0); sleep(10); mouse_event(MOUSEEVENTF_LEFTUP,X,Y,0,0);
- SetCursorPos(786+(need3-1)*100, 350+(need4-1)*100); sleep(10);
- mouse_event(MOUSEEVENTF_LEFTDOWN,X,Y,0,0); sleep(10); mouse_event(MOUSEEVENTF_LEFTUP,X,Y,0,0);
- //dat[3,3]:='aaa'; dat[3,4]:='aaa'; dat[3,5]:='aaa';
- //Memo1.Lines.Add(IntToStr(chek(dat)));
- end;
- procedure TForm13.FormCreate(Sender: TObject);
- begin
- setlength(dat,8,8);
- setlength(dat2,8,8);
- end;
- procedure TForm13.sButton1Click(Sender: TObject);
- begin
- Timer2.Enabled:=true;
- end;
- procedure TForm13.Timer1Timer(Sender: TObject);
- var p: TPoint;
- DC: HDC;
- begin
- GetCursorPos(p);
- Edit1.Text:=Format('%d - %d', [p.X, p.Y]);
- DC:= GetWindowDC(0);
- Panel1.Color:= GetPixel(DC, p.X, p.Y);
- Edit3.Text:=IntToStr(GetRValue(GetPixel(DC, p.X, p.Y)));
- Edit4.Text:=IntToStr(GetGValue(GetPixel(DC, p.X, p.Y)));
- Edit5.Text:=IntToStr(GetBValue(GetPixel(DC, p.X, p.Y)));
- end;
- procedure TForm13.Timer2Timer(Sender: TObject);
- begin
- Button1.Click();
- end;
- procedure TForm13.Timer3Timer(Sender: TObject);
- begin
- Close();
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement