Hey all. My name is fletch and I love minesweeper. I also enjoy coding in c++ and have combined the two loves into creating an autoplayer.
my current fastest time is .64 seconds and I regularly get <1 second completions in expert. intermediate and easy both complete in less than .01 second and thusly can't be accurately measured. I win less than 5% of my expert games, completing as many as 5 fails a second. I win 90% of my easy games and around 40% of intermediate.
My code uses absolutely no memory hacking, all calculations are based on reading physical screen pixel data in realtime. I can post the code that reads the screen and feeds the functional class for processing and the code for the functional class aswell if anyone is interested.
I use a heuristic calculating approach. Calculate mine squares (when a number = blank squares it touches + mines it touches) recursively untill no new mines are found. find safe squares (squares touching numbers touching that number in mines) and click all of those. Guesses are made by finding the square touching the lowest total number. I had a perfect guessing algorythm but it regularly took 50ms to complete as it required recursively stepping 2 squares out instead of just the 1. so it was scrapped for this version which clicks the same square 70% of the time.
my program currently has a single problem- I had to run two processes simultaneously- Keyboard processing to calibrate and pause upon function failure and the actual processing thread. because the keyboard processing has to be done in the main thread, and I haven't quite tweeked the processing thread properly, My memory runs out quite quickly and it can no longer read the screen. I can complete about 350 actions before this happens which can usually win a game or two in expert.
here is a single video of it running I made recently. Hope you guys enjoy and I'd LOVE some insite on how to make it faster.
if I can manage to figure out my memory leak issue, I can make this draw dots directly to the screen buffers over squares. Red dots for mine squares, blue for safe, purple for 'safest'... These dots wouldn't be saved to replay files.
with the autoplayer, I can make the mouse move like a human would move it, and I can throttle it to essentially any time. I've been working on this project for AGES.
Anything to do with minesweeper...
1 post • Page 1 of 1