Jump to content

Minesweeper Hack


w0uter
 Share

Recommended Posts

My script does not click on (or move the mouse to) every box, it also places the mine flag where mines are found. So, it's possible to end the game before the entire grid has been examined. To see it, run on a custom grid, 24 by 30 with only 10 mines, you'll see it skip the empty space.

Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Link to comment
Share on other sites

I have a code similiar to w0uter's if not the same code except I have been adding to mine so it gives options.

I have found out that it will mess up every other one. I will try and see if it works with the fix mentioned by mikeytown2.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

im haveing the same problem it keeps hittingmines, i thought it may be it was moving to fast, so i added Sleep(10) in the last for loop. still nothing, so i then tried opening scite and using alt+f5 so i didnt move mouse and still nothing (it kept hitting mines).

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Link to comment
Share on other sites

w0uter

i use winxp sp2, default skin

BigDod

change 112 to 100, its near the bottom of the code. that fixed it for me

That fixed it for me. Cool


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

My new script now does expert in 1 second. It's not pretty, but it is pretty cool. It 'pre-scans' (the not pretty part) the grid which does not count against the clock then solves by randomly clicking (the pretty cool part). I discovered a new way to click that made it happen. Apparently you can middle click to expose cells if all the surrounding mines have been discovered. Middle clicking does not work as well if you go in sequential order since many (as much as half) of the cells are already exposed. I click randomly but never on an already exposed cell (or mine). So, I get the optimum speed... 1 second, on expert even.

#CS
    Computer Cheats at Minesweeper # 2
    Works on any size grid (within reason)
    Computer plays minesweeper extremely fast - 1 second on expert

    Inspired by "Freekills Minesweeper Cheats"
#CE

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

; Exit via Ctrl-Alt-X
HotKeySet("^!x", "MyExit")

dim $title = "Computer Cheats at Minesweeper"
dim $win = "Minesweeper"

dim $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2
dim $i, $j, $color, $color1, $Cols, $Rows

If WinExists($win) = 0 then
    Run(@SystemDir & "\winmine.exe")
    Sleep(500)
endIf

WinActivate($win)
Sleep(50)

; Get Minesweeper info
$size = WinGetPos($win)
$wX = $size[0]
$wY = $size[1]
$Width = $size[2]
$Height = $size[3]

; Start coords of mine grid -relative to window
$X1 = 16
$Y1 = 97

; End coords of mine grid -relative to window
$X2 = $Width - 11
$Y2 = $Height - 11

; size of each box;W=16;H=16
; Determine Grid size from window size
$Cols = int(($X2 - $X1 + 1) / 16)
$Rows = int(($Y2 - $Y1 + 1) / 16)

if MsgBox(4, $title, "Ready?" & @CR & @CR & "Cols: " & $Cols & @CR & "Rows: " & $Rows & @CR ) <> 6 then exit

Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 1)

WinActivate($win)
;MouseMove($Width / 2, 69)
MouseClick("left", $Width / 2, 69, 1, 0); click new game

; Send happy fun code
Send("xyzzy{RSHIFT}{ENTER}")

; Pre calculate X Y cordinates and save to an array (for random looping later on)
dim $aXY[$Rows * $Cols][2]
dim $k = 0
For $i = 0 to $Rows - 1
    $Y = int($Y1 + (($Y2 - $Y1) / $Rows * ($i + 1)) - 8)
    For $j = 0 to $Cols - 1
        $X = int($X1 + (($X2 - $X1) / $Cols * ($j + 1)) - 8)
        $aXY[$k][0] = $X
        $aXY[$k][1] = $Y
        $k += 1
    Next
Next

sleep(300)

; Must be 1, this version will not work without pre-search
$PreSearch = 1

; Find Mines & remove from array - does not count against time
if $PreSearch Then
    For $i = 0 to ($Rows * $Cols) - 1
        $X = $aXY[$i][0]
        $Y = $aXY[$i][1]

        Opt("PixelCoordMode", 1)
        MouseMove($X, $Y, 0)
        $color = PixelGetColor(0, 0)
        If $color = 16777215 Then
            continueloop
        ElseIf $color = 0 Then
            MouseClick("right")
            $aXY[$i][0] = -1
            $aXY[$i][1] = -1
        EndIf
    Next
Endif

; Random is not just cool looking it helps! just barely faster..
ArrayRandomize2($aXY)

Opt("PixelCoordMode", 0)
For $i = 0 to ($Rows * $Cols) - 1
    $X = $aXY[$i][0]
    if $X == -1 then ContinueLoop
    $Y = $aXY[$i][1]

    $color1 = PixelGetColor($X - 7, $Y)
; Unclicked/Unknown color
    If $color1 = 16777215 then
        MouseMove($X, $Y, 0)
        MouseClick("left")
        MouseClick("middle")
    EndIf
Next

; Send happy fun code again to reset the 'mode'
Send("xyzzy{RSHIFT}{ENTER}")


Exit
; Exit via Ctrl-Alt-X
Func MyExit()
    Exit
EndFunc

; UN-sorts a 2 dimensional array - 2 passes
Func ArrayRandomize2 ( ByRef $a)
    local $Idx1, $Idx2
    local $Ubound = UBound($a, 1), $i, $tmp
    For $i = 0 to $Ubound * 2
        $Idx1 = Random(0, $Ubound - 1)
        $Idx2 = Random(0, $Ubound - 1)
        $tmp = $a[$Idx1][0]
        $a[$Idx1][0] = $a[$Idx2][0]
        $a[$Idx2][0] = $tmp
        $tmp = $a[$Idx1][1]
        $a[$Idx1][1] = $a[$Idx2][1]
        $a[$Idx2][1] = $tmp
    Next
EndFunc
Link to comment
Share on other sites

phear my skillez.

use ANY setting and click in the bottom right corner.

Func _MemOpen($i_dwDesiredAccess, $i_bInheritHandle, $i_dwProcessId)
    
    Local $av_Return[2] = [DllOpen('kernel32.dll')]
    Local $ai_Handle = DllCall($av_Return[0], 'int', 'OpenProcess', 'int', $i_dwDesiredAccess, 'int', $i_bInheritHandle, 'int', $i_dwProcessId)
    If @error Then
        DllClose($av_Return[0])
        SetError(1)
        Return 0
    EndIf
    $av_Return[1] = $ai_Handle[0]
    Return $av_Return
EndFunc;==> _MemOpen()

Func _MemWrite($i_hProcess, $i_lpBaseAddress, $v_Inject, $s_Type = 'byte', $i_nSize = 1)
    
    Local $v_Struct = DllStructCreate ($s_Type & '[' & $i_nSize & ']')
    DllStructSetData ($v_Struct, 1, $v_Inject)
    $i_Call = DllCall($i_hProcess[0], 'int', 'WriteProcessMemory', 'int', $i_hProcess[1], 'int', $i_lpBaseAddress, 'int', DllStructGetPtr ($v_Struct, 1), 'int', $i_nSize, 'int', '')
    DllStructDelete ($v_Struct)
    Return $i_Call[0]
    
EndFunc;==> _MemWrite()

Func _MemClose($i_hProcess)
    
    $av_CloseHandle = DllCall($i_hProcess[0], 'int', 'CloseHandle', 'int', $i_hProcess[1])
    DllClose($i_hProcess[0])
    Return $av_CloseHandle[0]
    
EndFunc;==> _MemClose()

$i_pid = Run('winmine.exe')
ProcessWait($i_pid)

$v_Open = _MemOpen (56, False, $i_pid)

$i_Width = RegRead('HKEY_CURRENT_USER\Software\Microsoft\winmine', 'Width')
$i_Height = RegRead('HKEY_CURRENT_USER\Software\Microsoft\winmine', 'Height')
$i_Mines = RegRead('HKEY_CURRENT_USER\Software\Microsoft\winmine', 'Mines')

Global $i_Mine = 0

For $y = 1 To $i_Height
    For $x = 1 To $i_Width
        If $i_Mine < $i_Mines Then
            _MemWrite($v_Open, 0x1005340 + 32 * $y + $x, -113)
            $i_Mine += 1
        Else
            _MemWrite($v_Open, 0x1005340 + 32 * $y + $x, 15)
        EndIf
    Next
Next

_MemClose ($v_Open)
Edited by w0uter

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

Middle click or click both the right and left buttons at the same time does the same thing. I will have to try this stuff out.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • 9 months later...

yeah, not sure if anyone has pointed this out yet, but he is monitoring the pixel in the upper left of your screen. for a colour change from white to black.

im sure we all knew this, he has applied the old XYZZY SHIFT+ENTER cheat.

the pixel changes to black whenever a mine is under the cursor.

interesting way to monitor it, i got kind of exited thinging you might have done it by grabbing the numbers and doing the math... that would have been sooo much more 1337 then applying the cheat and then solving it.

sorry guys, IMHO - this script just improves on an old cheat, it doesnt "solve" anything, just makes cheating quicker.

Link to comment
Share on other sites

yeah, not sure if anyone has pointed this out yet, but he is monitoring the pixel in the upper left of your screen. for a colour change from white to black..

If you're talking about Koder's script then you're correct, but if you're

talking about Wouter's script then I would suggest you to actually study his script.

Link to comment
Share on other sites

If you're talking about Koder's script then you're correct, but if you're

talking about Wouter's script then I would suggest you to actually study his script.

LOL, i slipstreamed my Winxp Install and removed all the games from the install base by using nlite.

no minesweeper for me.

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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