Console game in C++

Build a console game in C++ which goal is to fill out the cell board with the corresponding number. The program doesn’t need to have a GUI like the one shown below; it is just a visual representation. Indeed, it should be run in the terminal. The following are the game rules:

  1. Consecutive numbers must be adjacent, either horizontally, vertically or diagonally.
  2. For the 5×5 grids there are 25 positions and all those positions need to have a number on it.
  3. All numbers must be placed in the corresponding row, column, or diagonal in which they appear around the border of the board grid.

The game starts with the user choosing the position for the number 1 as shows the image below:


Immediately after that happens, the program calculates and displays the value of the outer grid with the numbers to be chosen as a guide for the user.


The user then fills out the 5×5 grid by using the already preset values in the outer grey square as a guide on how to fill it out

In summary, the project is for a C++ console program, the instructions specific are:

  1. Display a 7×7 grid on screen like the one shown in the first image.
  • The ‘1’ must be randomly placed within its inner 5×5 grid.
  • The surrounding numbers 2->25 are visible to the user immediately after the user chooses the position for number one.
  • The solution must be hidden but could be made available to the user by entering the passcode “solution”.
  1. User can enter a 4-digit value to place a number onto a cell. For example, from top to bottom and left to right, entering “0932” means placing “9” to the cell at the third row and second column. Entering “1443” means placing “14” to the cell in the fourth row and third column.
  2. User can enter “0000” to reset or undo the number placed previously and this can be repeated more than once.
  3. Invalid input with incorrect number or row/column that violates the rules results in an error message and allows re-entering another value.
  4. Using classes and objects is not required meaning it can be a non-OO program, but the main() should contain as few statements as possible.
  5. The program should be called console_game.cpp.


Last Updated on February 10, 2019