GIGJ.COM
welcome to my space
X
Personal Injury | Languages | Soups | Photography | Email | Prepress | Exotic Locations | Computer Games | Related articles
Search:  
Welcome to:gigj.com
NAVIGATION - HOME
minesweeper
Published by: smith 2010-03-14
  • 1) The playing board consists of 81 adjacent cells arranged as 9 rows and 9 columns. 2) Some of these cells will randomly chosen to contain bombs. There will be 10 bombs in total. 3) Initially, all playing cells are covered. 4) A player must attempt to uncover squares, one by one. 5) If the square stores a bomb, the player loses. Otherwise, a number should be revealed that indicates the number of bombs in adjacent squares. 6) If that number is 0, then you should automatically recursively uncover all adjacent squares as well, that are not already cleared. 7) Play continues until the player has either chosen a bomb, or uncovered all squares that do not contain a bomb. If the latter occurs, the player wins. This is a short explanation of the game, if you have questions about the details, (ie. what would happen in a particular situation) please ask either the TAs or the lecturers. Output specifications You may alter your output to make it fancy in any way that you like, but your output must conform to these specifications: 1) In the beginning of the game, you prompt the user with a reasonable display of the covered board, with each board cell clearly labeled with its subscripts. 2) After the board is displayed, you must prompt the user for a square to uncover. 3) Your program should then re-prompt the user with a new picture of the board showing its status after the player's move has been executed. This pattern should persist until either the player uncovers a bomb, at which point an appropriate message should be printed to the screen and the game ended, or until the player wins. Another appropriate message should be printed to the screen in this situation. A Sample Run: In the following sample run, the covered cells are displayed as ‘_’, uncovered cells are either blank (if there are no adjacent bombs) or contains a number indicating the number of bombs in the 8 adjacent cells. The bombs are represented with the ‘*’ character. 0 1 2 3 4 5 6 7 8 -------------------- 0 _ _ _ _ _ _ _ _ _ 1 _ _ _ _ _ _ _ _ _ 2 _ _ _ _ _ _ _ _ _ 3 _ _ _ _ _ _ _ _ _ 4 _ _ _ _ _ _ _ _ _ 5 _ _ _ _ _ _ _ _ _ 6 _ _ _ _ _ _ _ _ _ 7 _ _ _ _ _ _ _ _ _ 8 _ _ _ _ _ _ _ _ _ Enter cell coordinates:0 0 0 1 2 3 4 5 6 7 8 -------------------- 0 1 _ 1 1 2 2 1 1 _ 1 2 _ _ 2 1 _ 1 3 _ _ 2 1 _ 1 4 _ _ 1 1 1 1 5 _ _ 1 6 _ _ _ 1 7 _ _ _ 1 8 _ _ _ 1 Enter cell coordinates:3 0 (NOTE: Here the cells are uncovered recursively. Because there were no bombs adjacent to the cell [0][0] . The recursion stops when we hit a cell with at least one adjacent bomb.) 0 1 2 3 4 5 6 7 8 -------------------- 0 1 _ 1 1 2 2 1 1 _ 1 2 _ _ 2 1 _ 1 3 3 _ 2 1 _ 1 4 _ _ 1 1 1 1 5 _ _ 1 6 _ _ _ 1 7 _ _ _ 1 8 _ _ _ 1 Enter cell coordinates:2 1 0 1 2 3 4 5 6 7 8 -------------------- 0 1 * 1 1 2 2 1 1 1 1 2 * * 2 1 1 1 3 3 * 2 1 * 1 4 1 1 1 1 1 1 5 2 2 1 6 * * 2 1 7 3 4 * 1 8 1 * 2 1 Ooops! You hit a bomb... Game is over !


  • If this is minesweeper, shouldn't they be called mines, not bombs? Anyway, I wrote a program, enclosed, to the specification. I lightly commented it; you should put in more comments perhaps. If you have any questions, please do not hesitate to ask. As general rule, I like to recommend that Java programmers try Topcoder, at http://www.topcoder.com . This sponsors various programming contests; you can use Java, C++, or C#. It's a lot of fun and an excellent way to improve programming skills (I'm preparing for round 3 of their $150,000 invitational Wednesday). The only things to note about this program are the error checking on the input. Also, I added a feature whereby if you call the program with three arguments, like: java MineSweeper 3 3 2 it will create a board with 3 rows, 3 columns, and 2 bombs in it. This is useful for checking that the program actually works, since it is much easier to win a small board with few bombs. I am enclosing the program, followed by some sample output import java.io.BufferedReader; public class MineSweeper{ int nrows; //number of rows (9) int ncolumns; // number of columns (9) int nbombs; //number of bombs in the grid booleanbombs; // true if corresponding grid square has a bomb booleancovered; // true if corresponding grid square is covered intbombneighbors; //number of bombs that are neighbors of each non-bomb grid square int nremaining; // number of non-bomb covered grid squares remaining static BufferedReader reader; // reader from where standard input is to be read public MineSweeper (){} public String toString(){ StringBuffer b = new StringBuffer(); b.append("n "); for (int i=0;i
    Mine Sweeper 1.0::
    Mine Sweeper 1.0 - Mine Sweeper is a simple game widget in the Windows Mine Sweeper game fashion.
    http://wareseeker.com/Windows-Widgets/mine-sweeper-1.0.zip/314208
    HOME
    =0&&row=0&&column
    NavSource Mine Sweeper Photo Archive::
    During the decade of the 1950s sixty-five new minesweepers were built. These new minesweepers were designated Minesweeper, Ocean (MSO).
    http://www.navsource.org/archives/11/02idx.htm
    HOME
    Minesweeper with JavaScript::
    This a is a new version of the famous Minesweeper game. For those who are not familiar with this game, the principle is to uncover all the squares that do
    http://www.via.ecp.fr/~vbp/test/mines/
    HOME


  • I'm sorry to see that my indentation of the program did not translate very well to the to the google format; I'm not sure there is a good standard way to upload programs. Most editors have an automatic indentation format, so you should be able to import the code into your editor and reformat it. If you have trouble using this or the indentation is a problem, let me know and I will try and think of another way to get the program to you, or I will explore alternative indentation strategies. Note that I think some of the long comments might have been split onto two lines.


  • Well, I went through and tried to shorten all the long lines. I hope this version looks better in the HTML; it is the same program, but I hope reformatted to look better on your computer screen when you view it in HTML: import java.io.BufferedReader; public class MineSweeper{ //number of rows (9) int nrows; // number of columns (9) int ncolumns; //number of bombs in the grid int nbombs; // true if corresponding grid square has a bomb booleanbombs; // true if corresponding grid square is covered booleancovered; //number of bombs that are neighbors of each non-bomb grid square intbombneighbors; // number of non-bomb covered grid squares remaining int nremaining; // reader from where standard input is to be read static BufferedReader reader; public MineSweeper (){} public String toString(){ StringBuffer b = new StringBuffer(); b.append("n "); for (int i=0;i
    minesweeper: Definition from Answers.com::
    minesweeper n. A ship equipped for detecting, destroying, removing, or neutralizing explosive marine mines.
    http://www.answers.com/topic/minesweeper
    HOME
    =0&& row=0&& column

  • on minor problem with this program ... i intended it to be a C program... and the program sent seems to have three erros


  • i know in my haste i did not specify what language to write the code in but is there anyway or any one you know who can implement the code in see using structures


  • You wrote: "on minor problem with this program ... i intended it to be a C program... and the program sent seems to have three erros" I can rewrite in C, certainly. However, before I do so, what are the "three errors" that the current version of the program has?


  • At any rate, here is a C program that does the same thing as the Java program, except the size of the board and the number of bombs is a compile-time constant. Again, please feel free to ask for any clarifications or questions. I put fairly basic functionality in the program since I am not sure exactly how you intend to use it. To run, just compile and run with no arguments: /*simple minesweeper program for google answers by rbnn*/ #include #include #define nrows 9 #define ncolumns 9 #define nbombs 10 int bombs[nrows][ncolumns]; int covered[nrows][ncolumns]; int bombneighbors[nrows][ncolumns]; int nremaining; void uncover(int row, int column){ int newrow,newcolumn; if (MineValid(row,column)&& covered[row][column]){ covered[row][column]=0; --nremaining; if (bombneighbors[row][column]==0) for (newrow=row-1;newrow<=row+1;++newrow) for (newcolumn=column-1; newcolumn<=column+1; ++newcolumn) uncover(newrow,newcolumn); } } void MinePrint(){ int i,r,c; char out; int neighbors; printf("n "); for (i=0;i=0&& row=0&& column




    Nortel Unveils Vision, Strategy for Israeli High-Performance Net
    Busy Friday Leads to Strong Close for Net Stocks
  • PRINT Add to favorites
  • where can i get backstage passes for the x factor live tour please answer
  • where do you think survivor 18 will be
  • what did richard hammond name his car in the tg africa challenge
  • i need help will you help me
  • why do you love hate family guy
  • if a concert is in the round does that mean the performer will not stay facing one direction the whole time
  • desperate houswives
  • would u date me i want to know
  • what to expect from a metro station meet greet
  • when does alicia menshew kendall return to all my children
  • help me fear of courage the cowardly dog king ramses
  • who do you think is gonna win survivor gabon
  • who is the cast on family guy
  •  
  • what should i give my teacher on his retirement
  • what does the end of twilight remind you of
  • to get in to a club do you have to
  • just wondering about some show ~ ~ keisha something
  • how long does the cast on survivor have to walk to tribal council elimination
  • dell t3200 inspiron notebook
  • i need a name for a tv show similar to gossip girl any ideas
  • why do radio stations have contests for free ipods
  • obsessed guy trying to steal my girlfriend does anyone have advice for getting him away from her
  • who is your favorite character on southpark and why
  • is it a new episode of desperate housewives coming on tonight at 10 or is it a rerun p
  • what did you think of the real world hollywood
  • fun help i want fun pleasees
  • in your opinion what is the most memorable episode story of doctor who with peter davison the 5th doctor
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about minesweeper , Please add it free.
    About us |Contact us |Advertisement |Site map |Exchange links
    Copyright© 2008gigj.com All Rights Reserved