Google Blogoscoped

Forum

ClickRed Game  (View post)

Brian Brian [PersonRank 2]

Tuesday, May 31, 2005
15 years ago

I wrote a little program that plays your game. He's not very smart, but he does get pretty far (all the way eventually). Requires AutoIt 3. I'd post a windows executable but not in an "anonymous" forum.

;match any string in the window title
AutoItSetOption("WinTitleMatchMode",2)

;tell the window to become active and wait until it is
WinActivate("ClickRed")
If NOT WinActive("ClickRed") Then
WinWaitActive("ClickRed")
EndIf

Do
;if you alt+tab away from the window it will stop
If WinActive("ClickRed") Then

;find the pixel
;left coord, top, right, bottom, color to search, shade-variation, pixels to scan for at once
;make the last number 1 and you will eventually beat the game. for every number it is higher
;than one it will take that much longer to find it
$location = PixelSearch(209,185,793,646,0xDC3250,0,5)
If IsArray($location) Then
;if it found something red (0xDC3250), click on it!
MouseClick("left",$location[0],$location[1],1,0)
EndIf
EndIf

;do it forever
Until 1 = 0

Brian Brian [PersonRank 2]

15 years ago #

Hehe, "Congratulations you finished the game!" =)

The last level required some human intervention.

deletedsoul [PersonRank 0]

15 years ago #

Arrrghhh...so irritating. Yet, addicting.

Dan Kramer [PersonRank 1]

15 years ago #

Good one. Took me 227 seconds.

Philipp Lenssen [PersonRank 10]

15 years ago #

AutoIt sounds interesting. I've never heard of it before.

Brian Brian [PersonRank 2]

15 years ago #

It's a powerful language for what it allows you to do in a few lines of code. That said, it's not very fast. I find myself using it most of the time to resolve quirks in windows applications. For example, iTunes' minimize button sometimes refuses to work. I just alt+tab over to AutoIt and type one line of code:

WinSetState("iTunes",'',[put at-character here]SW_MINIMIZE)

and voila, it does as I tell it to do =)

Anonymous! [PersonRank 0]

15 years ago #

11 seconds.
I'm a god.

This thread is locked as it's old... but you can create a new thread in the forum. 

Forum home

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!