Koder Posted May 13, 2005 Posted May 13, 2005 (edited) This is totally and completey inspired by Wb-FreeKill's Minesweeper cheats, I wasted the day, thanks! In this script the computer plays Minesweeper and does it extremely fast, cheating the whole time of course. expandcollapse popup#CS Computer Cheats at Minesweeper Works on any size grid (within reason) Computer plays minesweeper extremely fast Inspired by "Freekills Minesweeper Cheats" #CE ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") ; MouseMove speed where applicable dim $speed = 0 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, $color2, $pos, $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 AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) WinActivate($win) ; Send happy fun code Send("xyzzy{RSHIfT}{ENTER}") For $i = 1 to $Rows ;[EDIT] faster yet again without this line... WinActivate($win) For $j = 1 to $Cols ; Center of each box $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) ; Unclicked/Unknown color If $color1 = 16777215 then ; Waive the mouse around a bit to get the pixel ; Center MouseMove($X, $Y, 0) ; Bottom right ;[EDIT] works without this line... MouseMove($X1 + (($X2 - $X1) / $Cols * $j) - 4, $Y1 + (($Y2 - $Y1) / $Rows * $i) - 4, $speed) $color = PixelGetColor(0, 0) If NOT $color = 0 Then MouseClick("left") Else MouseClick("right") EndIf EndIf Next;j Next;i Exit ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc [EDIT] I removed the second MouseMove and it's even faster.. [EDIT] removed the WinActivate inside the loop.. much faster.. beats mine sweeper in 1 second Edited May 13, 2005 by Koder
layer Posted May 13, 2005 Posted May 13, 2005 Seriosuly though, no cheat could get 0 seconds except for mine $warning = MsgBox(16 + 4, "WARNING!", "WARNING! Please turn off MineSweeper if you have it running! This prorgram writes to the registry in order to change the values of the names and scores! CONTINUE?") If $warning = 7 Then Exit Else $name = InputBox("MineSweeper Cheat", "Enter your name for the highscore") If @error Then Exit $time = InputBox("MineSweeper Cheat", "Enter the time you want for your record") If @error Then Exit ProgressOn("MineSweeper Cheat Progress", "Progress:") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\winmine\", "Name1", "REG_SZ", $name) ProgressSet(50) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\winmine\", "Time1", "REG_DWORD", $time) ProgressSet(100) ProgressOff() MsgBox(0, "Complete!", "MineSweeper will now be run. When it comes up, go to 'Game>Best Times...' and you'll find your name there!") Run("winmine.exe", "C:\WINDOWS\System32") EndIf Good work by the way FootbaG
w0uter Posted May 13, 2005 Posted May 13, 2005 its faulty. sometimes it flags evrything as a mine. ( i think this is becuz the mines are actually 'replaced' before the 1st click. ) ( thats why you never hit a bomb the first click ) My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll
Koder Posted May 13, 2005 Author Posted May 13, 2005 its faulty. sometimes it flags evrything as a mine.( i think this is becuz the mines are actually 'replaced' before the 1st click. )( thats why you never hit a bomb the first click )<{POST_SNAPBACK}>It will fail if the cheat code is sent twice, seems to toggle cheat mode on and off. Start the script without Minesweeper running.
w0uter Posted May 13, 2005 Posted May 13, 2005 (edited) It will fail if the cheat code is sent twice, seems to toggle cheat mode on and off. Start the script without Minesweeper running.<{POST_SNAPBACK}>expandcollapse popup#CS Computer Cheats at Minesweeper Works on any size grid (within reason) Computer plays minesweeper extremely fast Inspired by "Freekills Minesweeper Cheats" #CE ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") ; MouseMove speed where applicable dim $speed = 0 dim $cheats = 0 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, $color2, $pos, $Cols, $Rows If WinExists($win) = 0 then Run(@SystemDir & "\winmine.exe") Sleep(500) $cheats = 1 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 ; resets the mines Send('{F2}') AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) WinActivate($win) ; Send happy fun code If $cheats = 1 Then Send("xyzzy{RSHIfT}{ENTER}") For $i = 1 to $Rows ;[EDIT] faster yet again without this line... WinActivate($win) For $j = 1 to $Cols ; Center of each box $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) ; Unclicked/Unknown color If $color1 = 16777215 then ; Waive the mouse around a bit to get the pixel ; Center MouseMove($X, $Y, 0) ; Bottom right ;[EDIT] works without this line... MouseMove($X1 + (($X2 - $X1) / $Cols * $j) - 4, $Y1 + (($Y2 - $Y1) / $Rows * $i) - 4, $speed) $color = PixelGetColor(0, 0) If NOT $color = 0 Then MouseClick("left") Else MouseClick("right") EndIf EndIf Next;j Next;i Exit ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc Edited May 13, 2005 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
steveR Posted May 14, 2005 Posted May 14, 2005 It has to do with the cheat code:Send("xyzzy{RSHIfT}{ENTER}") AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Wb-FreeKill Posted May 14, 2005 Posted May 14, 2005 (edited) very well done, good job Edited May 14, 2005 by Wb-FreeKill
datkewlguy Posted May 15, 2005 Posted May 15, 2005 hey i thought of a way to boost your times, instead of left clicking the area u know is not a mine, just mark the xy coords and at the very end click them all (timer doenst start til u click one) so just mark all the mines then clean up in the end. should really boost ur score
buzz44 Posted May 15, 2005 Posted May 15, 2005 (edited) Especiialy when you have the maximum grid size. 30x24 = 667 mines. Takes it average 33 seconds.Edit: I just realised you never hit a mine first click. So the board layout, of the mines and blanks, is not set until you make the first click. Edited May 15, 2005 by Burrup qq
Helge Posted May 15, 2005 Posted May 15, 2005 @datkewlguy :I managed to lower the highscore with over 50% using : Opt("MouseClickDelay",0) Opt("MouseClickDownDelay",0)Test runned with width as 24, height as 34 and with 667 mines.Also, one way of speeding it up is to use that DLLCall-mousemoveas it is much faster than MooseMove()
this-is-me Posted May 15, 2005 Posted May 15, 2005 I imagine mousemove through dllcall would be much faster than moosemove because of the difference in weights of a mouse versus a moose. Who else would I be?
Helge Posted May 15, 2005 Posted May 15, 2005 (edited) I imagine mousemove through dllcall would be much faster than moosemove because of the difference in weights of a mouse versus a moose.<{POST_SNAPBACK}>Yep, that was the idea !But then again, how much does a cursor weight ? Or are we talking aboutthe mouse itself ? But that's probably not important, I guess..Edit: Typo... Edited May 15, 2005 by Helge
JSThePatriot Posted May 16, 2005 Posted May 16, 2005 One more optimization... You dont have to mark the mines if you can click all of the numbers. Below is the slightly modified code. expandcollapse popup#CS Computer Cheats at Minesweeper Works on any size grid (within reason) Computer plays minesweeper extremely fast Inspired by "Freekills Minesweeper Cheats" #CE ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") ; MouseMove speed where applicable dim $speed = 0 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, $color2, $pos, $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 AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) WinActivate($win) ; Send happy fun code Send("xyzzy{RSHIfT}{ENTER}") For $i = 1 to $Rows ;[EDIT] faster yet again without this line... WinActivate($win) For $j = 1 to $Cols ; Center of each box $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) ; Unclicked/Unknown color If $color1 = 16777215 then ; Waive the mouse around a bit to get the pixel ; Center MouseMove($X, $Y, 0) ; Bottom right ;[EDIT] works without this line... MouseMove($X1 + (($X2 - $X1) / $Cols * $j) - 4, $Y1 + (($Y2 - $Y1) / $Rows * $i) - 4, $speed) $color = PixelGetColor(0, 0) If NOT $color = 0 Then MouseClick("left") Else ContinueLoop ;MouseClick("right");Removed to make it quicker JSThePatriot(Jarvis Stubblefield) EndIf EndIf Next;j Next;i Exit ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc One other thing you might want to check into is that you may want to add an option to do it again. Just a thought instead of me having to go back to SciTE and press F5 everytime I want it to go. Also you could allow it to select the difficulty. If you would like I will spend my time on it and repost, but it is your project 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)
Koder Posted May 16, 2005 Author Posted May 16, 2005 It's potentially faster by right clicking mines because it's possible to mark the last mine before all the spaces are cleared thus stopping the clock. Also the mouse must move over that space anyway... wow, this did speed it up, 65% faster on expert. Opt("MouseClickDelay",0) Opt("MouseClickDownDelay",0) I'm going to write another one that will solve the puzzle without cheating. Maybe using linked list or a tree structure of some sort. Won't be as fast and may hit a mine (guessing will be required), but it will waste lots more time
Skooga Posted April 14, 2006 Posted April 14, 2006 (edited) I know this is like a year old, but I just ran across it and thought I would throw up some adjustments. I made it pick all the bombs first so you have a chance at getting all the bombs cleared first and I added a loop function as well as a difficulty selection for those who wanted it. It is pretty sweet and fast now. Check it out. expandcollapse popup#CS Computer Cheats at Minesweeper Works on any size grid (within reason) Computer plays minesweeper extremely fast Inspired by "Freekills Minesweeper Cheats" #CE ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") ; MouseMove speed where applicable dim $speed = 0 Opt("MouseClickDelay",0) Opt("MouseClickDownDelay",0) dim $title = "Computer Cheats at Minesweeper" dim $win = "Minesweeper" $loop=1 While $loop=1 dim $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2 dim $i, $j, $color, $color1, $color2, $pos, $Cols, $Rows dim $loop, $diff 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 AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) WinActivate($win) ; Send happy fun code Send("xyzzy{RSHIfT}{ENTER}") ;PUTS OUT FLAGS FIRST For $i = 1 to $Rows For $j = 1 to $Cols $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) If $color1 = 16777215 then MouseMove($X, $Y, 0) $color = PixelGetColor(0, 0) ;*ADDED* Make it select the mines first, in order to win faster possibly. If NOT $color = 0 Then Sleep(1) Else MouseClick("right") EndIf EndIf Next;j Next;i ;CLICKS FINALLY For $i = 1 to $Rows ;[EDIT] faster yet again without this line... WinActivate($win) For $j = 1 to $Cols ; Center of each box $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) ; Unclicked/Unknown color If $color1 = 16777215 then ; Waive the mouse around a bit to get the pixel ; Center MouseMove($X, $Y, 0) ; Bottom right ;[EDIT] works without this line... MouseMove($X1 + (($X2 - $X1) / $Cols * $j) - 4, $Y1 + (($Y2 - $Y1) / $Rows * $i) - 4, $speed) $color = PixelGetColor(0, 0) If NOT $color = 0 Then MouseClick("left") Else ContinueLoop ;MouseClick("right");Removed to make it quicker JSThePatriot(Jarvis Stubblefield) EndIf EndIf Next;j Next;i $loop = Msgbox(1, $win, "Repeat?") If $loop=1 then WinClose($win) Run(@SystemDir & "\winmine.exe") Sleep(500) endIf If $loop = 1 then $diff = InputBox($win, "Which difficulty 1-3 (1=easy, 2=int., 3=expert) Would you like?", " ") If $diff = 1 then send ("{Alt}gb") endIf If $diff = 2 then send ("{Alt}gi") endIf If $diff = 3 then send ("{Alt}ge") endIf Else exit EndIf WEnd Exit ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc Edited April 14, 2006 by Skooga
RazerM Posted April 15, 2006 Posted April 15, 2006 (edited) this is amazing. I don't get how it works though. What does the cheat do Edit: searched google. I know now. very cool Edited April 15, 2006 by RazerM My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
RazerM Posted April 15, 2006 Posted April 15, 2006 i made a gui for it. expandcollapse popup#include <GUIConstants.au3> GUICreate("Minesweeper Cheater", 300, 150) $clicksafe = GUICtrlCreateCheckbox("Click safe squares", 10, 20) $flagmines = GUICtrlCreateCheckbox("Flag Mines", 10, 40) $questionmines = GUICtrlCreateCheckbox("Place '?' on mines", 10, 60) $beginner = GUICtrlCreateRadio("Beginner ", 150, 20) $intermediate = GUICtrlCreateRadio("Intermediate ", 150, 40) $expert = GUICtrlCreateRadio("Expert ", 150, 60) $run = GUICtrlCreateButton("Run Minesweeper", 10, 120, 100, 25) GUISetState() Dim $clicksafe2, $flagmines2, $questionmines2 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $run If GUICtrlRead($clicksafe) = $GUI_CHECKED Then $clicksafe2 = 1 If GUICtrlRead($flagmines) = $GUI_CHECKED Then $flagmines2 = 1 If GUICtrlRead($questionmines) = $GUI_CHECKED Then $questionmines2 = 1 If GUICtrlRead($beginner) = $GUI_CHECKED Then $mode = 1 If GUICtrlRead($intermediate) = $GUI_CHECKED Then $mode = 2 If GUICtrlRead($expert) = $GUI_CHECKED Then $mode = 3 ExitLoop EndSwitch WEnd HotKeySet("{END}", "End") Opt("WinTitleMatchMode", 3) $title = "Minesweeper" If WinExists($title) = 0 then Run(@SystemDir & "\winmine.exe") If @error Then Exit Sleep(50) EndIf WinActivate($title) Sleep(50) If $mode = 1 Then Send("!gb") If $mode = 2 Then Send("!gi") If $mode = 3 Then Send("!ge") $pos = WinGetPos($title) $MineX = $pos[0] $MineY = $pos[1] $MineW = $pos[2] $MineH = $pos[3] $x1 = 16 $y1 = 97 $x2 = $MineW - 11 $y2 = $MineH - 11 $MineC = Int(($x2 - $x1 + 1) / 16) $MineR = Int(($y2 - $y1 + 1) / 16) AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) Send("xyzzy{RSHIfT}{ENTER}") For $i = 1 To $MineR For $j = 1 To $MineC $x = int($x1 + (($x2 - $x1) / $MineC * $j) - 8) $y = int($y1 + (($y2 - $y1) / $MineR * $i) - 8) Opt("PixelCoordMode", 0) $color = PixelGetColor($x - 7, $y) Opt("PixelCoordMode", 1) If $color = 16777215 Then MouseMove($x, $y, 0) $cheat = PixelGetColor(0,0) If Not $cheat = 0 Then If $clicksafe2 Then MouseClick("primary") Else If $flagmines2 Or $questionmines2 Then MouseClick("secondary") If $questionmines2 Then MouseClick("secondary") ContinueLoop EndIf EndIf Next Next $loop = Msgbox(1, $title, "Would you like to play(or cheat) again?") If $loop=1 then WinClose($title) ;~ Run(@SystemDir & "\winmine.exe") If @Compiled = 1 Then Run(@ScriptFullPath) If @Compiled <> 1 Then Run(@ComSpec & ' /c ' & FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath), '', @SW_HIDE) Exit EndIf Func End() Exit EndFunc My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now