程式設計實現連連看機械人外掛程式

2021-04-18 01:44:08 字數 3325 閱讀 7197

在《黑客防線》發表過的一篇,沒什麼含量,  

連連看是一款非常不錯的休閒遊戲,相信大家都玩過。這裡的連連看是單機版

v3.0

,網上曾經有過此類外掛程式,不過只能通過修改記憶體遊戲數值提高生命值和提示數量。顯然在自動化日益發達的今天,它不能滿足我們完全自動化的要求。於是乎,機械人玩遊戲提上日程。程式設計工具:

delphi7.0

;連連看單機版

v3.0

。unit unit1;

inte***ce

…………

implementation

varhwinmain,phandle:thandle;

pid:dword;

procedure tform1.pressf5;

begin

postmessage(hwinmain,wm_keydown,vk_f5,0);// hwinmain

遊戲主窗體控制代碼

postmessage(hwinmain,wm_keyup,vk_f5,0);

end;

procedure tform1.cheate;

varpint,plife:integer;

s_cb:dword;

begin

pint:=100;

plife:=600;

getwindowthreadprocessid(hwinmain,@pid);//

獲取主窗體執行緒

id

phandle:=openprocess(process_all_access,false,pid);//

開啟程序

if phandle <> 0 then

begin

if chk1.checked then writeproces**emory(phandle,pointer($

12f4d4),@plife,1,s_cb);//

寫記憶體

if chk2.checked then writeproces**emory(phandle,pointer($12febc),@pint,1,s_cb);

endelse

begin

開啟程序失敗

','錯誤

',0);

tmr1.enabled :=false;

end;

end;

function tform1.gettopxy:trect;

varcprect:trect;

begin

if hwinmain <> 0 then

begin

getwindowrect(hwinmain,cprect);

result := cprect;

end;

end;

function tform1.getcolor(x,y:integer):tcolor;

varhdc: thandle;

yourcolor: tcolor;

begin

hdc := getdc(0);

withtcanvas.createdo

tryhandle:=hdc;

yourcolor:= pixels[x,y];

result:=yourcolor;

finally

free;

releasedc(0,hdc);

end;

end;

procedure tform1.autorungame;

varx,y,m,n:integer;

topx,topy:integer;

rec:trect;

begin

rec := gettopxy;

topx := rec.left;

topy := rec.top;

pressf5;//

按下快捷鍵

f5

for n:=1 to 7 do

begin

y:= topy+163+45+50*(n-1);

for m:= 1 to 12 do

begin

x := topx+154+30+40*(m-1);

if getcolor(x,y) = 8421376 then //

擷取座標點顏色值

begin

setcursorpos(x,y);

mouse_event(mouseeventf_leftdown,0,0,0,0);//

模擬滑鼠按鍵

end;

end;

end;

end;

procedure tform1.btn1click(sender: tobject);

begin

hwinmain:= findwindow('#32770','

連連看');//

查詢主窗體控制代碼

if (chk1.checked or chk2.checked) then

begin

if (hwinmain<>0 )then

tmr1.enabled := true

else

遊戲未啟動

','提示

',0);

endelse

請至少選擇乙個功能

','提示

',0);

end;

procedure tform1.tmr1timer(sender: tobject);

begin

cheate;//

修改遊戲記憶體數值過程

end;

procedure tform1.btn2click(sender: tobject);

begin

tmr1.enabled :=false;

end;

procedure tform1.btn3click(sender: tobject);

begin

btn1click(self);

setforegroundwindow(hwinmain);

if findwindow('#32770','

連連看')=0 then exit;//

未發現遊戲窗體則退出

tmr2.enabled:=true;

end;

procedure tform1.tmr2timer(sender: tobject);

begin

autorungame;

if findwindow('#32770','

成功')<>0 then tmr2.enabled:=false;//

過關停止

end;

end.

連連看演算法的實現

圖 0,0,0,0,0,0,0,0,0,0 0,8,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0 0,0,0,0,...

連連看演算法的實現

連連看演算法的實現 收藏 圖 0,0,0,0,0,0,0,0 0,0 0,8,0,0,0,0,0,0 0,0 0,0,0,0,0,0,0,0 0,0 0,0,0,0,0,0,0,0 0,0 0,0,0,0,0,0,0,0 0,0 0,0,0,0,0,0,0,0 0,0 0,0,0,0,0,0,0,0...

連連看小遊戲前端實現

先看一下遊戲的介面 一點選開始,遊戲就開始計時,頂部的折扣會飛速上公升,如果玩家玩的速度太慢的話那麼只能拿到乙個他都不想要的折扣了,呵呵 開始 span div div var gridw document.width 7 每乙個格仔的寬度,根據螢幕的寬度來定,做到自適應 var gridh doc...