Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Programmers minesweeper  (Read 3749 times)
0 Members and 1 Guest are viewing this topic.
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Posted 2005-10-25 17:03:14 »

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...
Click to Play

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
1. it has won
2. it has lost a specified number of games. the default is 10 games...
3. 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) <a href="">here</a>...
Offline cborders

Junior Devvie

« Reply #1 - Posted 2005-10-25 17:13:32 »

 Cool Pretty Cool!
Offline Spasi
« Reply #2 - Posted 2005-10-25 18:36:27 »

Wow, awesome util! Wink

The algorithm could be greatly improved though, there're a lot of tricks that it doesn't "know" about. It plays like a n00b! Tongue Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline swpalmer

JGO Coder

Exp: 12 years

Where's the Kaboom?

« Reply #3 - Posted 2005-10-26 04:20:47 »

Haha  I did the EXACT SAME THING in C a few years ago.  I actually wanted to make a Java version a while back, but never got around to it.

Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #4 - Posted 2005-10-26 06:32:55 »

i agree it is an inefficient algorithm.

could this be used as the base of an AI competition? Plenty of room for improvement and its a simple enough task

basically to see who can write the algorithm that wins the most games and the quickest (say out of 1000)... the operation to re-scan the board, for example takes a fair chunk of time so eg. an optimal algo would minimize its reliance on that operation...

the data is represented as a 2D array of ints...

of course, seconds would be nowhere near accurate enouh to decide, so eg. printing the system time taken to complete would be used.

i could easily clean it up, have it take a runnable object for the algorithm, make getters and setters for the array, and make public the method that scans the whole board and one that just checks a single tile... that sort of thing, so that you can write a swappable algorithm is run by the program (minimizes cheating by changing stuff that shouldn't be changed, and running the official tests would use the same framework)

i do know a couple of where u have  121 next to a wall of unknowns, the block next to the 2 is always safe...
Offline Spasi
« Reply #5 - Posted 2005-10-26 10:29:28 »

could this be used as the base of an AI competition? Plenty of room for improvement and its a simple enough task

Clean it up and I'm in. Wink
Offline nonnus29

Senior Devvie

Giving Java a second chance after ludumdare fiasco

« Reply #6 - Posted 2005-10-26 11:58:22 »

Some guy proved that this game is turing complete on an infinite grid and an NP complete problem.  Every game is not garunteed to be solvable.

Offline Raghar

Junior Devvie

Ue ni taete 'ru hitomi ni kono mi wa dou utsuru

« Reply #7 - Posted 2005-10-26 20:45:16 »

What about caravel drod? It's much better for AI.
Offline JuddMan

Senior Devvie

Medals: 1

Your Ad Here

« Reply #8 - Posted 2005-10-28 03:07:55 »

no, of course u can't guarantee a win. that's the challenge.

it makes the competition less about speed and more about AI...
finding a clever way to minimize the need to guess, and when you must guess, choosing the least risky option...

there's an applet that supposedly wins 60% of the expert games it plays, but it also generates the games itself...

it would be interesting if the algorithm worked as well on the real thing.

there are also tradeoffs you can make when updating the information, which would for example trade speed for accuracy etc...

i'll tidy up the code, add comments etc. and make a standard way to access the functions then...

and see if i can organise a prize or two...
Pages: [1]
  ignore  |  Print  

EgonOlsen (1573 views)
2018-06-10 19:43:48

EgonOlsen (1657 views)
2018-06-10 19:43:44

EgonOlsen (1145 views)
2018-06-10 19:43:20

DesertCoockie (1573 views)
2018-05-13 18:23:11

nelsongames (1174 views)
2018-04-24 18:15:36

nelsongames (1664 views)
2018-04-24 18:14:32

ivj94 (2421 views)
2018-03-24 14:47:39

ivj94 (1631 views)
2018-03-24 14:46:31

ivj94 (2719 views)
2018-03-24 14:43:53

Solater (884 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!