Thread: AI Contest - Minesweeper

  1. #1
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503

    AI Contest - Minesweeper

    Ok I know I had promised a Risk AI, and it is finished and ready to go, but I think because of the complexity there wasn't enough interest (between 2 websites even), so I am gonna hold onto it for a bit. Anyway, what I do have is a much simpler AI that even beginners may fair well at while still giving a challenge to the regulars ....drum roll please............

    Announcing: A Minesweeper AI contest:

    Rules:
    1. You are to derive a class from the provided Player class.
    2. Please remit by email (littled at gmail) one file .h or .hpp to me with your implementation.
    3. You must overide all virtual functions
    4. If your implementation crashes my computer or locks it up in an infinite loop you will be disqualified.
    5. Entries should be submitted by April 8th 12:00pm EST
    6. Winning: The player receiving the highest score wins.
    7. Scoring is as follows: 1000 random boards will be created. Each player will play each of the boards. Every square you uncover that is not a bomb, you get 1 point. every time you blow up, you lose 5 points. If you complete a board(uncover all non-bombs) you get 500 points.
    8. You may not call srand() in your code.
    9. You may not use any tricks to call/read private members of the minefield class
    10. A reference to the minefield class is passed to your class in the getMove() call. You can call any public method it has. See code below for available methods.
    11. I will post a test framework in a few days, but initially I don't want to distract from the task at hand.
    12. FYI: the gridsize/bomb count used is equivilent to the expert level in the windows version
    13. More FYI: When instanciating a base class player, it typically scores -200 just randomly picking squares. I have created a slightly better than random player that typically scores around 20000. Both of these will be playing, but should be easy to beat. I might also enter an unofficial advance player if I have time.
    14. Even More FYI: Maximum achievable points = 881000, min = -5000, Max with no wins = 375000
    15. NEW The first move is guaranteed non-bomb, and because of this, I have revised scoring system.
    16. NEW Not really new, but I didn't mention it before. Returning an invalid position or a square that is already uncovered will be treated as a BOMB!

    17. The most important rule: Have Fun!!!

    Code:
    Code removed in favor of download of code
    Get Code Here
    Last edited by Darryl; 03-22-2006 at 08:33 AM.

  2. #2
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Just out of curiosity, any way to alleviate the possibility of a strong AI accidentally clicking on a bomb as his first pick every time?

  3. #3
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Quote Originally Posted by PJYelton
    Just out of curiosity, any way to alleviate the possibility of a strong AI accidentally clicking on a bomb as his first pick every time?
    Well, I thought about that, and I remember the discussion here a while back, however since there are so many runs, every AI will have it's share of bad luck (roughly 1 of every 5). The betters ones should still come out ahead in the long run in the scoring.


    *** UPDATE ***
    I just found out that the windows minesweeper guarantees the first click is not a bomb, so I guess I will do the same.
    Last edited by Darryl; 03-22-2006 at 01:23 AM.

  4. #4
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    Darryl, there are no header guards in minefield.h. If I include it in my own header file, there are linker errors.

    So can I assume that you'll definitely include it before including my header file?

    Edit:

    Another thing, does your framework support cascading like the Windows version? In other words, when I click on a mine that has no surrounding bombs, it uncovers its neighbours until a square that has surrounding bombs is found?
    Last edited by Dante Shamest; 03-30-2006 at 11:48 AM.

  5. #5
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    Another thing, does your framework support cascading like the Windows version?
    I don't think so, given the code for his SimpleBot. Unless I'm understanding the code all wrong, the SimpleBot's method is to clear out all around any 0's, then pick a random number if there are no 0's to be had.
    There is a difference between tedious and difficult.

  6. #6
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Will the number of mines in the field be constant? Also, is there any way of determining how many mines remain to be uncovered?
    Last edited by jverkoey; 04-01-2006 at 03:16 AM.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Will the number of mines in the field be constant?
    14. Even More FYI: Maximum achievable points = 881000, min = -5000, Max with no wins = 375000
    Probably.



    First time joining a code contest!

  8. #8
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Will the number of mines in the field be constant?
    Sorry, I didn't see this earlier, but yes, I am duplicating the expert level on windows minesweeper that uses 99 bombs...(though the framework is flexible, and just for kicks I may try out the beginners's and intermediate as well) Also, you are not uncovering bombs, you are uncovering non-bombs and leaving the bombs covered. In the real game you flag them, but that's just for us humans with bad memories, you ai should be able to track where the bombs are without flagging them.

    Another thing, does your framework support cascading like the Windows version?
    I don't think so, given the code for his SimpleBot. Unless I'm understanding the code all wrong, the SimpleBot's method is to clear out all around any 0's, then pick a random number if there are no 0's to be had.
    That's correct, you must manually clear out the 0's .... That feature in windows I would say is for the benefit of human playability.

    Darryl, there are no header guards in minefield.h. If I include it in my own header file, there are linker errors.

    So can I assume that you'll definitely include it before including my header file?
    That was the plan, to include my header before the players. I would had put everything in one big cpp file but I think it would had been a tad confusing ( or a tad more :-)

    (I don't seem to be able to edit my original post, but when you hit a bomb it's -9 points and not 5)
    Last edited by Darryl; 04-03-2006 at 08:13 AM.

  9. #9
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    "Also, is there any way of determining how many mines remain to be uncovered?"

  10. #10
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Quote Originally Posted by jverkoey
    "Also, is there any way of determining how many mines remain to be uncovered?"
    I just edited above that you aren't uncovering bomb but instead, non-bombs there are 480 squares to begin, 99 have bombs, so 381 are non-bombs which need to be uncovered. The game will not end until they all are uncovered or you uncover a bomb. In any event, it should be fairly easy to track how many are left to uncover.

  11. #11
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Ah hah, sorry, didn't see the edit.

  12. #12
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    One more... we can be *guaranteed* that each instance of our Player-s will one game and only one, right? I feel like caching parts of the board each move, just for kicks.

  13. #13
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    Quote Originally Posted by jafet
    One more... we can be *guaranteed* that each instance of our Player-s will one game and only one, right? I feel like caching parts of the board each move, just for kicks.
    The players are local variables created in a loop, so each iteration of the loop recreates your player that then plays one game, so yes it is guaranteed.
    Last edited by Darryl; 04-04-2006 at 08:04 AM.

  14. #14
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Home computer crashed so it looks like its unlikely I can submit an entry. Damn!!

  15. #15
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    I have a few people that want to sumbit but running short on time..and since next weekend is a long holiday weekend here in Cayman (Good Friday and Easter Monday are holidays here) I will extend it till the 15th of April, just submit along with your taxes :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Action Game - AI Contest
    By Queatrix in forum Contests Board
    Replies: 4
    Last Post: 01-18-2007, 06:55 PM
  2. New AI contest: sign up
    By Sang-drax in forum Contests Board
    Replies: 20
    Last Post: 07-27-2005, 05:54 PM
  3. chess ai contest
    By Raven Arkadon in forum Contests Board
    Replies: 7
    Last Post: 07-09-2005, 06:38 AM
  4. AI Contest Proposal
    By MadCow257 in forum Contests Board
    Replies: 4
    Last Post: 03-13-2005, 03:27 PM
  5. Game Design Topic #1 - AI Behavior
    By TechWins in forum Game Programming
    Replies: 13
    Last Post: 10-11-2002, 10:35 AM