Jump to content
Sign in to follow this  
AlmarM

MineSweeper Expert Bot!

Recommended Posts

AlmarM

Hi!

This time me and my friend wrote a simple MineSweeper Expert Bot. Just 25 lines of code :mellow:

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

HotKeySet("{ESC}", "_Exit")

Menu()

Func Menu()
    $x = InputBox("* Mode *", "1 = Beginner" & @CRLF & "2 = Advanced" & @CRLF & "3 = Expert" & @CRLF & "4 = Woah", "", "", 100, 160)
    If $x = 1 Then
        Beginner()
    ElseIf $x = 2 Then
        Advanced()
    ElseIf $x = 3 Then
        Expert()
    ElseIf $x = 4 Then
        Woah()
    Else
        MsgBox(16, "^ERROR", "Please just typ '1, 2 or 3'.")
        Exit
    EndIf
EndFunc

Func Beginner()
    Run("winmine.exe")
    WinWaitActive("Mijnenveger")
    WinMove("Mijnenveger", "", 229, 187)
    Sleep(500)
    Send("!{S}{B}")
    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    For $i = 250 To 380 Step 16
        For $ii = 300 To 430 Step 16
            MouseMove($i, $ii, 0)
            $var = PixelGetColor(0, 0)
            If $var = 0xFFFFFF Then
                MouseClick("LEFT", $i, $ii, 1, 0)
            ElseIf $var = 0x000000 Then
                MouseClick("RIGHT", $i, $ii, 1, 0)
            EndIf
        Next
    Next
    MsgBox(64, "* Won *", "You Won!")
EndFunc

Func Advanced()
    Run("winmine.exe")
    WinWaitActive("Mijnenveger")
    WinMove("Mijnenveger", "", 326, 248)
    Sleep(500)
    Send("!{S}{G}")
    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    For $i = 350 To 590 Step 16
        For $ii = 360 To 600 Step 16
            MouseMove($i, $ii, 0)
            $var = PixelGetColor(0, 0)
            If $var = 0xFFFFFF Then
                MouseClick("LEFT", $i, $ii, 1, 0)
            ElseIf $var = 0x000000 Then
                MouseClick("RIGHT", $i, $ii, 1, 0)
            EndIf
        Next
    Next
    MsgBox(64, "* Won *", "You Won!")
EndFunc

Func Expert()
    Run("winmine.exe")
    WinWaitActive("Mijnenveger")
    WinMove("Mijnenveger", "", 326, 248)
    Sleep(500)
    Send("!{S}{E}")
    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    For $i = 350 To 820 Step 16
        For $ii = 360 To 600 Step 16
            MouseMove($i, $ii, 0)
            $var = PixelGetColor(0, 0)
            If $var = 0xFFFFFF Then
                MouseClick("LEFT", $i, $ii, 1, 0)
            ElseIf $var = 0x000000 Then
                MouseClick("RIGHT", $i, $ii, 1, 0)
            EndIf
        Next
    Next
    MsgBox(64, "* Won *", "You Won!")
EndFunc

Func Woah()
    Run("winmine.exe")
    WinWaitActive("Mijnenveger")
    WinMove("Mijnenveger", "", 326, 248)
    Sleep(500)
    Send("!{S}{P}")
    Send("{TAB 2}1000{TAB}1000{TAB}1000{ENTER}")
    Send("xyzzy")
    Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")
    For $i = 300 To 826 Step 16
        For $ii = 360 To 730 Step 16
            MouseMove($i, $ii, 0)
            $var = PixelGetColor(0, 0)
            If $var = 0xFFFFFF Then
                MouseClick("LEFT", $i, $ii, 1, 0)
            ElseIf $var = 0x000000 Then
                MouseClick("RIGHT", $i, $ii, 1, 0)
            EndIf
        Next
    Next
    MsgBox(64, "* Won *", "You Won!")
EndFunc
Func _Exit()
    Exit
EndFunc

Ill update it soon with Easy and Advanced!

Hope you enjoy :(

P.S.

Just replace 'Mijnenveger' with 'Minesweeper' or other language's!

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
AlmarM

Updated >.<

AlmarM


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
BrettF
wIck3d

Nice work. Didn't work at first though, I had to add a sleep to it.

HotKeySet("{ESC}", "_Exit")
Run("winmine.exe")
WinWaitActive("Minesweeper")
Sleep(1000)
WinMove("Minesweeper", "", 326, 248)
Sleep(1000)
Send("xyzzy")
Send("{SHIFTDOWN}{ENTER}{SHIFTUP}")

For $i = 350 To 820 Step 16
    For $ii = 360 To 600 Step 16
        MouseMove($i, $ii, 0)
        sleep(1)
        $var = PixelGetColor(0, 0)
        If $var = 0xFFFFFF Then
            MouseClick("LEFT", $i, $ii, 1, 0)
        ElseIF $var = 0x000000 Then
            MouseClick("RIGHT", $i, $ii, 1, 0)
        EndIf
        
    Next
Next
MsgBox(64, "* Won *", "You Won!")

Func _Exit()
    Exit
EndFunc

Score: 15 sec :mellow:

Share this post


Link to post
Share on other sites
BrettF

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.