Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

i badly need ur help..

Im trying to solve this problem..but dunno how..
im just a beginner using c++ as a language..
can anybody help me code this one??..pleaseeee..
pleaseee..any help is very much appreciated..
This is a one player game of a simplified version of the popular computer game
minesweeper. First, the user is asked if he or she wants to play on a 5x5 grid or 10x10
grid. You have two 2-dimensional arrays that contains information about your grid. An
entry in the array should either contain a 0 or 1. A 1 signifies that there is a bomb in
that location, and a 0 if none.
For example, given the array:
int bombList5by5[][]={{0, 0, 1, 0, 0},
{0, 0, 0, 0, 0},
{0, 1, 0, 0, 0},
{0, 0, 0, 1, 1},
{0, 1, 1, 0, 0}};
Given the bomb list, we have 6 bombs on our list. The bombs are located in (row,col)
cells, (0,2), (2,1), (3,3), (3,4), (4,1) and (4,2).
If the user chooses a cell that contains a bomb, the game ends and all the bombs are
displayed. If the user chooses a cell that does not contain a bomb, a number appears at
that location indicating the number of neighbors that contain bombs. The game should
end when all the cells that do not contain bombs have been marked (player wins) or
when the user steps on a bomb(player loses).
Here's a sample output of the game, given the bombList5by5.
Welcome to Minesweeper!
Choose size of grid (Press 1 for 5x5, Press 2 for 10x10): 1
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
Enter row and column of the cell you want to open[row col]: 1 1
[ ] [ ] [ ] [ ] [ ]
[ ] [2] [ ] [ ] [ ]
[ ] [ ] [] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
Enter row and column of the cell you want to open[row col]: 3 2
[ ] [ ] [ ] [ ] [ ]
[ ] [2 ] [ ] [] [ ]
[ ] [ ] [ ] [ ] [ ]
[ ] [ ] [4 ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
Enter row and column of the cell you want to open[row col]: 0 2
[] [ ] [ ] [ ] [ ]
[ ] [2] [ ] [] [ ]
[ ] [X ] [ ] [ ] [ ]
[ ] [ ] [4] [ ] [ ]
[ ] [ ] [ ] [ ] [ ]
Ooppps! You stepped on a bomb. Sorry, game over!

Comments

Sign In or Register to comment.