Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Minesweeper

Name: Anonymous 2010-04-14 3:46

HALP!

Last year I wrote this program in VC++ that would analyze and automatically solve minesweeper boards in Windows XP.  It could/can solve expert boards in 1-2 seconds unless it hit a board configuration that it couldn't make progress on (though you can set it to guess randomly).

Now I want to modify it for Vista, but they completely changed the look of Minesweeper.  So where in the XP version, there were about 16 different colors used total in the entire game and it was easy to tell what type of square you were looking at by polling one strategically chosen pixel, the colors in the Vista version vary from square to square (see: http://i44.tinypic.com/28718ps.jpg).

The only challenge is to figure out a way to determine the type of square (unclicked, flagged, clicked with a "1", clicked with a "2", etc.) accurately and quickly enough to not bog down the program.  Everything else about the program can stay basically the same.

I thought of using the relative "darkness" of squares, since unclicked squares are darker, but looking at the actual RGB values shows that unclicked squares in the upper left corner can actually be darker than clicked squares in the lower right.

wat do?

Name: Anonymous 2010-04-14 4:13

Determine the size of the squares and their position, then train a vision system to recognize the squares based upon the colour proportions in the blocks.

Name: Anonymous 2010-04-14 4:28

solve minesweeper
Forget it, it's NP Complete.

Name: Anonymous 2010-04-14 4:54

Just read the data from the application's memory. Much easier and reliable. But try to show restraint and not have it read unopened tiles.

Name: Anonymous 2010-04-14 5:28

All the unrevealed squares look quite similar, only varying the blue tone. Pick as always your special pixel, but before checking it with your known table "noramlize" the whole square to a known degree of blue. If it looks like your normalized unclicked square, it's unclicked; if it doesn't, then proceed with your usual sinlge-pixel color-checking routine.

You may then optimize the normalization procedure by picking some other special pixels instead of the whole square.

Name: Anonymous 2010-04-14 5:59

The color (hue? whatever) seems to depend only on the taxi-cab distance of the square from the top left (i.e. squares on the same diagonal lines have the same colors).  Maybe you can figure out exactly how it varies and standardize the RGB value using the square's position on the board.

Name: Anonymous 2010-04-14 13:36

>>6
This should be all that's needed.

Name: Anonymous 2010-04-14 13:52

>>6
taxi-cab distance
It's called the Manhattan distance.

Name: Anonymous 2010-04-14 14:07

>>8
It's called MY ANUS]

Name: Anonymous 2010-04-14 14:43

Have you tried viewing only one channel of the image? Here's what it looks like without the blue channel. Looks to me like the corner squares are still darker than clicked squares. Clicked squares are also yellower, so an HSV conversion might help.

http://i39.tinypic.com/2mos0a1.jpg

Name: Anonymous 2010-04-14 15:49

Why has no one yet mentioned the Minesweeper JSON API? It's obviously the most straightforward solution.

Name: Anonymous 2010-04-14 16:06

>>11
Shush!

Name: ​​​​​​​​​​ 2010-10-25 20:44

Don't change these.
Name: Email:
Entire Thread Thread List