COSC 1436 Lab 4
Purpose: This focuses on
writing a game in C++.
Requirements C++ Programs: You
will be writing a C++ program for this lab that allows a player to play
Minesweeper.
This game really needs a GUI interface that uses a mouse, but that is much more
difficult, and not a requirement of this version. You will need to meet the
following requirements for your Minesweeper game:
- Your program must allow a player to enter their moves, and display their
moves. I recommend that you use the dash ( '-' ) and line ( '|' ) symbols
to make your output look better. Redraw the board after each player makes
their move.
- Validate that the move that the player entered was legal.
- Here are the rules for Microsoft Minesweeper: http://windows.microsoft.com/en-US/windows7/Minesweeper-how-to-play
- If the player is blown up, provide an appropriate comment. If all the mines
are successfully identified, then there is a winner.
- You only need to implement the beginner version (81 tiles, 10 mines), but
other versions will gain you bonus points.
- Players moves must be stored in a 2-dimension array C++ array.
Some hints to help you program the game:
- Make the size of the board a const global variable. If you are going to
allow the user to choose the size of the board, make the global variable the
maximum size of the board and then create a second variable in main that gives
the current size of the board. This avoids having to create dynamic arrays,
which we have not covered yet.
- In most version the placing of the bombs does not take place until after
the user chooses the first square, to avoid the user hitting a bomb on the
first move
- The Microsoft version auto fills areas of the game, where there are no bombs.
This uses what is known as a flood-fill algorithm that can be quite complex.
This can be done for extra credit.
Bonus. Make sure the basic lab works well
before you consider these more difficult options! This lab has many opportunities
for bonus points. My version used only the most basic characters, using enhanced
graphics (ASCII characters above 127) will earn bonus points. Letting the user
select the grid size and number of mines will earn bonus points. Adding a GUI
interface is a harder option.
Lab Report: Prepare a
lab report that contains the following information and submit it with your program:
-
-
-
-
Program output,
using the sample data given above
-
How was this
program tested, including the test cases you used to verify the program
worked properly.
-
What problems/successes
did you have with this program?
-
An estimate
of how much time you spent working on this assignment
Submission: You will be submitting this
lab via Blackboard, as demonstrated in class. You will need to zip your files
together and then upload your zipped submission to Blackboard. Make sure you
include the source code and the rest of the documentation package, but not the
executable files.
Grading Criteria: 100 points
available for this lab. There may be an additional 100 bonus points earned.
See the bonus section.