Skooga Posted April 16, 2006 Posted April 16, 2006 I tried compiling it and it would compile fine after I copied the GuiConstants.au3 out of the folder to the folder the file consists in. But it says there is no such thing as a Switch comand and the Select command is missing. Is there an error? Are you using AutoIt v3? Thanks for any help.
RazerM Posted April 16, 2006 Posted April 16, 2006 you need the Autoit beta for switch statements 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.
Koder Posted April 17, 2006 Author Posted April 17, 2006 I wrote a 'pre-search' for mine flags ages ago. I went nuts and made it random so it would look cool. I think it cheats too much... It can finish any grid in 1 second. I wrote another script that will 'play' without cheating. It actually won a game in about 10 seconds, unfortunately it was all luck. The algorithm gives me a headache just thinking about it. I like the un-sort function (ArrayRandomize2). Should be standard expandcollapse popup#CS Rick W Computer Cheats at Minesweeper # 2 Works on any size grid (without reason) Computer plays minesweeper extremely fast - 1 second on expert #CE Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Opt("WinTitleMatchMode", 3) ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") global $title = "Computer Cheats at Minesweeper" global $win = "Minesweeper" global $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2 global $i, $j, $color, $color1, $Cols, $Rows, $size 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) global $aXY[$Rows * $Cols][2] global $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 global $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; Remove mines from array $aXY[$i][1] = -1; mucho faster 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(0) ; 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
RazerM Posted April 18, 2006 Posted April 18, 2006 that is incredibly fast!! 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