Jump to content

Minesweeper bot: Advanced level in 1 second


Kiti
 Share

Recommended Posts

Skipped... ;Some straange characters instead the code revealed themselves...

I suppose there are a ton of things you could do... I'm done though lol.

But why did you choose that complicate method? Is it really better to use client choords?

I am not done though. I'll do a GUI for it, and maybe try to get compact all the spiral version in a single, imbricated for loop (this will be quite a challenge for a newbie like me :P ) :D

"Intellectuals solve problems, geniuses prevent them." - Doesn't count for you then

Whaaaa......T/Y !!!?? :):P

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

WinWaitActive("Minesweeper")
WinGetHandle("Minesweeper")
WinMove("Minesweeper", "", 229, 187)
$Time = TimerInit()
Send("xyzzy{LSHIFT}{ENTER}")
For $i = 0 To 7
    MouseMove(251, 299 + $i * 16, 0)
    For $k = 0 To 7
        MouseMove(251 + $k * 16, 299 + $i * 16, 0)
        $x = PixelGetColor(0, 0)
        If $x = 16777215 Then
            MouseClick("left")
        EndIf
    Next
Next
MsgBox(0,"Minesweeper", "Solved in " & TimerDiff($Time) & "s")

Link to comment
Share on other sites

WinWaitActive("Minesweeper")
WinGetHandle("Minesweeper")
WinMove("Minesweeper", "", 229, 187)
$Time = TimerInit()
Send("xyzzy{LSHIFT}{ENTER}")
For $i = 0 To 7
    MouseMove(251, 299 + $i * 16, 0)
    For $k = 0 To 7
        MouseMove(251 + $k * 16, 299 + $i * 16, 0)
        $x = PixelGetColor(0, 0)
        If $x = 16777215 Then
            MouseClick("left")
        EndIf
    Next
Next
MsgBox(0,"Minesweeper", "Solved in " & TimerDiff($Time) & "s")
Just add

Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)
,

put $time a line down, because that's the point when it actually start clicking, and you'll get a diffrence from 1530 s to 20s, but I think it's actually 1/1000 of a second, or a milisecond :) Very nice ideea :P

Edited by Kiti
Link to comment
Share on other sites

  • Moderators

But why did you choose that complicate method? Is it really better to use client choords?

I am not done though. I'll do a GUI for it, and maybe try to get compact all the spiral version in a single, imbricated for loop (this will be quite a challenge for a newbie like me :P ) :D

"Intellectuals solve problems, geniuses prevent them." - Doesn't count for you then

Whaaaa......T/Y !!!?? :):P

It's not complicated, it's done "correctly" IMHO. This way it doesn't matter where the client GUI is, and since MouseMove is slower than PixelSearch() or PixelGetColor() in this case, it's also the correct method IMHO.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The full beta version, including GUI finally released !!! :)

Check it out!

#include <GUIConstantsEx.au3>

Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)
Opt("GUIOnEventMode", 1)

Global $a = 0, $b = 0

MsgBox(64, "Hello!", "This is a cool script which solves Minesweeper in only 1 second ! Do you want to see it?")
Run(@SystemDir & "\winmine.exe")
WinWaitActive("Minesweeper")
WinGetHandle("Minesweeper")
WinMove("Minesweeper", "", 229, 187)
Send("xyzzy{LSHIFT}{ENTER}")

Global $gui = GUICreate("Custom Msgbox", 210, 210)
GUICtrlCreateLabel("Please check a box!", 10, 10)
Global $radio1 = GUICtrlCreateRadio("Beginner", 10, 60, 120, 20)
Global $radio2 = GUICtrlCreateRadio("Intermediate", 10, 90, 120, 20)
Global $radio3 = GUICtrlCreateRadio("Expert", 10, 120, 120, 20)
Global $Btn = GUICtrlCreateButton("Go Ahead", 50, 160, 90, 20)
GUICtrlSetState($radio1, $GUI_CHECKED)
GUICtrlSetOnEvent($Btn, "onPress")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

GUISetState()

While 1
    Sleep(100)
WEnd

;--------------- Functions ---------------
Func OnPress()
    $msg = GUIGetMsg()
    Select
        Case BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            GUISetState(@SW_HIDE)
            WinActivate("Minesweeper")
            WinWaitActive("Minesweeper")
            MouseClick("primary", 252, 227, 1, 0)
            MouseClick("primary", 252, 271, 1, 0)
            Global $m = 8
            Global $n = 8
        Case BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            GUISetState(@SW_HIDE)
            WinActivate("Minesweeper")
            WinWaitActive("Minesweeper")
            MouseClick("primary", 252, 227, 1, 0)
            MouseClick("primary", 252, 293, 1, 0)
            Global $m = 15
            Global $n = 15
        Case BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
            GUISetState(@SW_HIDE)
            WinActivate("Minesweeper")
            WinWaitActive("Minesweeper")
            MouseClick("primary", 252, 227, 1, 0)
            MouseClick("primary", 252, 304, 1, 0)
            Global $m = 15
            Global $n = 29
    EndSelect
    MsgBox(64, "Everything's set", "Press ok when you're ready")
    If $b = 0 Then
        ToolTip("Hey! Over here! Do you see me? Here comes the countdown:")
    Else
        ToolTip("Here comes the countdown:")
    EndIf
    Global $b = 1
    Sleep(2000)
    ToolTip("3")
    Sleep(1000)
    ToolTip("2")
    Sleep(1000)
    ToolTip("1")
    Sleep(1000)
    ToolTip("Go!")
    Sleep(1000)
    ToolTip("")
    If $a = 1 Then
        Opt("MouseCoordMode", 2)
        Opt("PixelCoordMode", 2)
        Local $hDesktop = WinGetHandle("[CLASS:WorkerW]")
        Local $hMineSweep = WinGetHandle("[CLASS:Minesweeper]")
        WinWaitActive($hMineSweep)
        Local $aWPos = WinGetPos($hMineSweep)

        For $y = 0 To $m
            For $x = 0 To $n
                $xc = 14 + ($x * 16)
                $yc = 57 + ($y * 16)
                PixelSearch($xc - 1, $yc, $xc - 1, $yc, 0xFFFFFF, 0, 14, $hMineSweep)
                If Not @error Then
                    MouseMove($xc, $yc, 5)
                    If (PixelGetColor(0, 0, $hDesktop) == 0xFFFFFF) Then
                        MouseClick("primary", $xc, $yc, 1, 0)
                    Else
                        MouseClick("secondary", $xc, $yc, 1, 0)
                    EndIf
                EndIf
            Next
        Next
    Else
        For $i = 0 To $m
            MouseMove(251, 299 + $i * 16, 0)
            For $k = 0 To $n
                MouseMove(251 + $k * 16, 299 + $i * 16, 0)
                $x = PixelGetColor(0, 0)
                If $x = 16777215 Then
                    MouseClick("left")
                Else
                    MouseClick("right")
                EndIf
            Next
        Next
    EndIf
    ToolTip("Hurray!!!")
    Sleep(2000)
    ToolTip("")
    Dim $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox(68, "Wow !!! Did you saw that? Just 1 second!", "Do you want to see it one more time " & @CRLF & "and, if you want, in slow motion?")
    Select
        Case $iMsgBoxAnswer = 6 ;Yes
            Dim $iMsgBoxAnswer2
            $iMsgBoxAnswer2 = MsgBox(36, "Cool !!!", "Wanna see it in slow motion?")
            Select
                Case $iMsgBoxAnswer2 = 6 ;Yes
                    MsgBox(64, "Ok then, slow motion", "Please select the level again" & @CRLF & "Tip: Select Beginner for better experience!")
                    Global $a = 1
                    GUISetState(@SW_SHOW)
                Case $iMsgBoxAnswer2 = 7 ;No
                    MsgBox(64, "Ok then, instant speed", "Please select the level again")
                    Global $a = 0
            EndSelect
            GUISetState(@SW_SHOW)
        Case $iMsgBoxAnswer = 7 ;No
            MsgBox(64, "Ok...", "Bye- Bye !!!" & @CRLF & "" & @CRLF & "               Regards," & @CRLF & "                        Kiti    ")
            WinKill("Minesweeper")
            Exit

    EndSelect

EndFunc   ;==>OnPress

Func OnExit()
    Exit
EndFunc   ;==>OnExit

P.S. Many thanks to SmOke_N, for sharing the second method of solving it (the one involving pixelgetcolor).

Link to comment
Share on other sites

this is cool :) I've noticed from before

Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

has a flaw with dual core CPUs. If they are set to 0 they send mouse clicks too fast, sometimes even so fast that the click is being skipped. I have dual core cpu, and with my PC your script fails, always hit a mine, but if I run it in "slow" mode (2nd run), then it's correct, and your script wins. Maybe you could add a question before your script starts whether the user has a dual core or single core CPU, and thus set the mouseclick / mouseclickdown delay.

p.s. it's the same with sendkey delay and sendkeydown delay.

Link to comment
Share on other sites

you could also make it faster by only moving the mouse when necessary.

this is happening in the second script, and even if I set the speed to 0, it's actually slower than the first one, I don't know why. :) . And that's why I chosed to make it even slower, because faster wouldn't work, and looks more cool actually beacuse it's not moving in a regular pattern.

this is cool biggrin.gif I've noticed from before has a flaw with dual core CPUs. If they are set to 0 they send mouse clicks too fast, sometimes even so fast that the click is being skipped. I have dual core cpu, and with my PC your script fails, always hit a mine, but if I run it in "slow" mode (2nd run), then it's correct, and your script wins. Maybe you could add a question before your script starts whether the user has a dual core or single core CPU, and thus set the mouseclick / mouseclickdown delay.

p.s. it's the same with sendkey delay and sendkeydown delay.

Thank you sandin for your observation! I'm working on this right now. :P

Edited by Kiti
Link to comment
Share on other sites

  • Moderators

this is cool :) I've noticed from before

Opt("MouseClickDelay", 0)
Opt("MouseClickDownDelay", 0)

has a flaw with dual core CPUs. If they are set to 0 they send mouse clicks too fast, sometimes even so fast that the click is being skipped. I have dual core cpu, and with my PC your script fails, always hit a mine, but if I run it in "slow" mode (2nd run), then it's correct, and your script wins. Maybe you could add a question before your script starts whether the user has a dual core or single core CPU, and thus set the mouseclick / mouseclickdown delay.

p.s. it's the same with sendkey delay and sendkeydown delay.

I don't have one to test on myself, but I am curious...

What is the optimum setting for a single core "0" setting versus a dual+ core "?" setting? ... what would "?" be?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I don't have one to test on myself, but I am curious...

What is the optimum setting for a single core "0" setting versus a dual+ core "?" setting? ... what would "?" be?

This is exactly what I wanted to ask him. But I thought dual cores also vary, so I've made a slidebar, from 0 to 10. Unfortunately, I've put this GUI inside another (as a case) and it's not working. :) I've shorten it as much as posible, and there's a topic in the GUI Help forum. After I figure it out, I'll put a new GUI (and function) improved version.
Link to comment
Share on other sites

Try this out.

You should change the title if it should work on your english version of windows

-press F3 to see it work.

HotKeySet( "{F3}", "MineSweep" )

Global $mineTitle = "Minestryger" ;change this for your own title

Dim $Squares[30][24][9]
Local $All_Unsolved
Local $Did_Something
Local $Did_Nothing
Local $Lost
Local $RandX
Local $RandY
Local $SmileyX
Local $SmileyY
Local $width
Local $height
Dim $pos[4]
Dim $Around[8][2]
Dim $Around2[8][2]
Dim $Around3[8][2]
Dim $Around4[8][2]
Local $Speed = 0
    Func ClickSquare( $i, $j, $button )
        GetAround( $i, $j )
        $Squares[$i][$j][0] = true
        $Around2 = $Around
        For $p = 0 to 7
            GetNumber( $Around2[$p][0], $Around2[$p][1] )
        Next
        Click( $pos[0] + $i * 16 + 8, $pos[1] + $j * 16 + 8, $button )
    EndFunc
    Func Click( $x, $y, $button )
        $All_Unsolved = false
        $Did_Something = true
        $Did_Nothing = false
        MouseMove( $x, $y, $Speed )
        MouseDown( $button )
        MouseUp( $button )
    EndFunc
    Func GetNumber( $i, $j )
        if $i >= 0 and $i < $width and $j >= 0 and $j < $height and $Squares[$i][$j][3] Then
            $Squares[$i][$j][7] = 0
            $Squares[$i][$j][8] = 0
            GetAround( $i, $j )
            For $p = 0 to 7
                $x = $Around[$p][0]
                $y = $Around[$p][1]
                if $x >= 0 and $x < $width and $y >= 0 and $y < $height Then
                    if not $Squares[$x][$y][0] Then
                        $Squares[$i][$j][7] = $Squares[$i][$j][7] + 1
                    ElseIf $Squares[$x][$y][1] Then
                        $Squares[$i][$j][8] = $Squares[$i][$j][8] + 1
                    EndIf
                EndIf
            Next
        EndIf
    EndFunc
    Func GetNumbers()
        For $i = 0 to $width - 1 Step + 1
            For $j = 0 to $height - 1 Step + 1
                GetNumber( $i, $j )
            Next
        Next
    EndFunc
    Func GetAround( $i, $j )
        $Around[0][0] = $i + -1
        $Around[0][1] = $j + -1
        $Around[1][0] = $i + 0
        $Around[1][1] = $j + -1
        $Around[2][0] = $i + 1
        $Around[2][1] = $j + -1
        $Around[3][0] = $i + -1
        $Around[3][1] = $j + 0
        $Around[4][0] = $i + 1
        $Around[4][1] = $j + 0
        $Around[5][0] = $i + -1
        $Around[5][1] = $j + 1
        $Around[6][0] = $i + 0
        $Around[6][1] = $j + 1
        $Around[7][0] = $i + 1
        $Around[7][1] = $j + 1
    EndFunc
    Func Guess()
    
    $Found = false
        For $i = 0 to $width - 1 Step + 1
            For $j = 0 to $height - 1 Step + 1
                if $Squares[$i][$j][3] and Random( 1, 2, 1 ) == 1 and ( $Squares[$i][$j][4] - $Squares[$i][$j][8] ) / $Squares[$i][$j][7] < 0.35 Then
                    if $i > 1 and not $Squares[$i-1][$j][0] then
                        ClickSquare( $i - 1, $j, "left" )
                        $Found = True
                        ExitLoop
                    ElseIf $i < $width - 2 and not $Squares[$i+1][$j][0] Then
                        ClickSquare( $i + 1, $j, "left" )
                        $Found = True
                        ExitLoop
                    ElseIf $j > 1 and not $Squares[$i][$j-1][0] Then
                        ClickSquare( $i, $j - 1, "left" )
                        $Found = True
                        ExitLoop
                    ElseIf $j < $height - 2 and not $Squares[$i][$j+1][0] Then
                        ClickSquare( $i, $j + 1, "left" )
                        $Found = True
                        ExitLoop
                    EndIf
                EndIf
            Next
            if $Found then ExitLoop
        Next
        if $Found then return
        While ( true )
            $i = Random( 0, $width - 1, 1 )
            $j = Random( 0, $height - 1, 1 )
            if not ( $Squares[$i][$j][0] ) Then
                ClickSquare( $i, $j, "left" )
                ExitLoop
            EndIf
            $RandX = $RandX + 1
            if $RandX == $width then
                $RandX = 0
                $RandY = $RandY + 1
                if $RandY >= $height then ExitLoop
            EndIf
        WEnd
    EndFunc
    Func MineAround()
        $Around3 = $Around
        For $p = 0 to 7 Step + 1
            $x = $Around3[$p][0]
            $y = $Around3[$p][1]
            if $x >= 0 and $x < $width and $y >= 0 and $y < $height and not $Squares[$x][$y][0] Then
                $Squares[$x][$y][1] = true
                ClickSquare( $x, $y, "right" )
            EndIf
        Next
    EndFunc
    Func SolveAround()
        $Around4 = $Around
        For $p = 0 to 7 Step + 1
            $x = $Around4[$p][0]
            $y = $Around4[$p][1]
            if $x >= 0 and $x < $width and $y >= 0 and $y < $height and not $Squares[$x][$y][0] Then
                ClickSquare( $x, $y, "left" )
            EndIf
        Next
    EndFunc
    Func ReadSquares()
        MouseMove( $SmileyX - 20, $SmileyY, 0 )
        For $i = 0 to $width - 1 Step + 1
            For $j = 0 to $height - 1 Step + 1
                if ( ( not $Squares[$i][$j][0] ) or ( not $Squares[$i][$j][6] ) and not $Squares[$i][$j][1] ) Then
                    Local $Left = $pos[0] + $i * 16
                    Local $Top = $pos[1] + $j * 16
                    Local $Right = $pos[0] + $i * 16 + 16
                    Local $Bottom = $pos[1] + $j * 16 + 16
                    if $Squares[$i][$j][0] then $Squares[$i][$j][6] = true
                    For $p = 1 to 1 Step + 0
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0xFFFFFF, 0, 2 )
                        If Not @error Then
                            PixelSearch( $Left, $Top, $Right, $Bottom, 0xFF0000, 0, 2 )
                            if not @error Then
                                If $All_Unsolved Then $All_Unsolved = false
                                $Squares[$i][$j][0] = true
                                $Squares[$i][$j][1] = true
                                ExitLoop
                            EndIf
                            PixelSearch( $Left, $Top, $Right, $Bottom, 0x000000, 0, 2 )
                            if not @error Then
                                $Lost = true
                                ExitLoop
                            EndIf
                            ExitLoop
                        EndIf
                        $Squares[$i][$j][0] = true
                        $Left = $Left + 4
                        $Top = $Top + 4
                        $Right = $Right - 8
                        $Bottom = $Bottom - 8
                        If $All_Unsolved Then $All_Unsolved = false
                        $Squares[$i][$j][3] = true
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x0000FF, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 1
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x008000, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 2
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0xFF0000, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 3
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x000080, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 4
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x800000, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 5
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x008080, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 6
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x000000, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 7
                            ExitLoop
                        EndIf
                        PixelSearch( $Left, $Top, $Right, $Bottom, 0x808080, 0, 2 )
                        If Not @error Then
                            $Squares[$i][$j][4] = 8
                            ExitLoop
                        EndIf
                        $Squares[$i][$j][3] = false
                        ExitLoop
                    Next
                EndIf
            Next
        Next
    EndFunc
    
    Func MineSweep()
        $All_Unsolved = true
        $Lost = false
        $RandX = 0
        $RandY = 0
        $SmileyX = $pos[0] + $width * 8
        $SmileyY = $pos[1] - 27
        $pos = WinGetPos( $mineTitle )
        if @error then
            $pos = WinGetPos( $mineTitle )
            if @error then
                $pos = WinGetPos( $mineTitle )
                if @error then return
            EndIf
        EndIf
        $pos[0] = $pos[0] + 14
        $pos[1] = $pos[1] + 103
        $width = Round( ( $pos[2] - 24 ) / 16 )
        $height = Round( ( $pos[3] - 113 ) / 16 )
        For $i = 0 to $width - 1 Step + 1
            For $j = 0 to $height - 1 Step + 1
                $Squares[$i][$j][0] = false
                $Squares[$i][$j][1] = false
                $Squares[$i][$j][2] = false
                $Squares[$i][$j][3] = false
                $Squares[$i][$j][4] = 9
                $Squares[$i][$j][5] = false
                $Squares[$i][$j][6] = false
                $Squares[$i][$j][7] = 8
                $Squares[$i][$j][8] = 0
            Next
        Next
        ReadSquares()
        $Did_Something = true
        While( true )
            $colour = PixelGetColor( $SmileyX, $SmileyY )
            if $Lost or $colour == 0x000000 then
                MouseMove( $SmileyX, $SmileyY, 0 )
                ExitLoop
            EndIf
            if not ( $Did_Something ) Then
                if $Did_Nothing then
                    Guess()
                Else
                    $Did_Nothing = True
                    ReadSquares()
                EndIf
            EndIf
            $Did_Something = false
            if ( $All_UnSolved ) Then Guess()
            GetNumbers()
            For $i = 0 to $width - 1 Step + 1
                $Exit = false
                For $j = 0 to $height - 1 Step + 1
                    if $Lost then $Exit = true
                    if $Squares[$i][$j][3] and not ( $Squares[$i][$j][5] ) Then
                        GetAround( $i, $j )
                        $Mines_Needed = $Squares[$i][$j][4] - $Squares[$i][$j][8]
                        $Unsolved = $Squares[$i][$j][7]
                        if $Mines_Needed == $Unsolved Then
                            if $Mines_Needed == 0 Then
                                $Squares[$i][$j][5] = true
                            Else
                                MineAround()
                            EndIf
                        EndIf
                        if $Mines_Needed == 0 and $Unsolved > 0 Then
                            SolveAround()
                        EndIf
                    EndIf
                Next
                if $Exit then ExitLoop
            Next
        WEnd
    EndFunc
While( true )
WEnd

Regards

Edited by newbiescripter
Link to comment
Share on other sites

newbiescripter,

try on italian windows XP (cheat doesn't work in this XP version)

do something but not finish job. Can you give us little explaination of your script ?

want to understand. thank you.

and sorry 4 english

m.

Link to comment
Share on other sites

Sorry, but I can't find a solution. I've tried setting mouse delay up to 500, but all it does is sending left mouse clicks, and if I hit "run in slow mode" all the script does is sending right mouse clicks (though it worked yesterday, it solved my expert minesweeper :) (but I was experimenting, and changde some values, but I didn't save them), it doesn't work now :P). Then I tried adjusting send key delay up to 500 and it was still failing. I'm sorry but I dunno how to help you with this issue. :P

p.s. about the delay mouse/key bug: I've noticed that when I was making a bot for a certain MMORPG, after I bought new PC with dual core CPU, the script wasn't sending all keys to the game, I didn't pay much attention to this, I thought it was some script prob, but then my friend who also bought dual core CPU told me he has the same problem, we solved it by increasing delay timing.

I never tried to compare these two, dual core delay vs. single core delay cause I gave my old PC to my sister which lives in another city, so I have only this one now... ;/

Edited by sandin
Link to comment
Share on other sites

newbiescripter,

try on italian windows XP (cheat doesn't work in this XP version)

do something but not finish job. Can you give us little explaination of your script ?

want to understand. thank you.

and sorry 4 english

m.

hmm.. the one I posted doesn't use the trick so if it stops is it because it either finish or hit a bomb.

if you want to make it work in the italian version then change the $mineTitle to the title of the italian version of minesweeper.

Regards

Link to comment
Share on other sites

sandin

Try this:

Run(@SystemDir & "\winmine.exe")
WinWaitActive("Minesweeper")
$speed = 10
Opt("MouseClickDelay", $speed)
Opt("MouseClickDownDelay", $speed)
WinGetHandle("Minesweeper")
WinMove("Minesweeper", "", 229, 187)
Send("xyzzy{LSHIFT}{ENTER}")
For $i = 0 To 8
    MouseMove(251, 299 + $i * 16, $speed)
    For $k = 0 To 8
        MouseMove(251 + $k * 16, 299 + $i * 16, $speed)
        $x = PixelGetColor(0, 0)
        If $x = 16777215 Then
            MouseClick("left")
        EndIf
    Next
Next

I'm almost 100% sure it will work. Then you can adjust $speed to the limit where it works. (Select the beginner mode)

Link to comment
Share on other sites

On my Computer I have to add a Loop from 0 to 1000, or it doesn't work, because the pixel doesn't change fast enough:

(with $speed = 0 :) )

MouseMove(251 + $k * 16, 299 + $i * 16, 0)
                For $sfsg = 0 To 1000
                Next
                $x = PixelGetColor(0, 0)
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

---EDIT :)

newbiescripter,

i've change setting for italian version then change the $mineTitle = "Campo fiorito"

Working, but after a while it stops because hit a bomb. (after go ahead in the rigth way)

Speak us about you and your script !

m.

Edited by myspacee
Link to comment
Share on other sites

i've change setting for italian version then change the $mineTitle = "Campo fiorito"

Working, but after a while it stops because hit a bomb. (after go ahead in the rigth way)

Speak us about you and your script !

m.

Me, SmOke_N or newbiescripter? :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...