I’ve created a timewaster that plays another timewaster… what a waste of time…
this one was just an experiment with the Robot class… it plays Windows Minesweeper. Very quickly.
Here’s what i mean…
http://www.adam.com.au/kellyjones/YABB/mine.gif
That’s a screenshot of my minesweeper game after running this little program a few times.
what it does is ‘reads’ the screen, and plays the game by manipulating the mouse. it’s not a very clever algorithm, sometimes expert can take over 100 goes to get it right… sometimes less than 30… a lot of luck is involved
a word of warning before you use it… It will take control of your mouse and play until either
- it has won
- it has lost a specified number of games. the default is 10 games…
- it thinks you closed Minesweeper. (or otherwise loses track or visibility of the play field)
it performs real mouse pointer movement and clicks. i take no responsibility if the program causes harm to your pc by clicking on something it shouldn’t… it’s good at realising when the game is gone… but if your desktop looks like the game, then it might not realise if you close Minesweeper. (it tracks squares by looking at the colour of the pixels)
to run it, first start up Minesweeper. position it toward the top left of the screen (no need for precision), and make sure the whole window is visible. Then select a dificulty and run the appropriate batch file. (be sure to move it off of minesweeper if it appears on top of it).
Also, here are some examples of running it from the command line…
java MinePlayer e 20 (Expert game, 20 attempts)
java MinePlayer b 10 (Beginner game, 10 attempts)
java MinePlayer i 10 (Intermediate game, 10 attempts)
java MinePlayer c 12 15 10 (Custom game, width 12, height 15, 10 attempts)
You can grab the source, class and bat files (to play beginner, intermediate, or advanced games) here…