Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.72 KB | None | 0 0
  1. 4.2.1   REQUIREMENTS
  2. Many board games require the generation of bi-dimensional boards, often filled with values generated based on game rules. In this task you are required to write a class that generates a square board composed of cells (i.e. it is organised like a matrix) The board must be created based on dimensions provided by the user, must be filled with numbers generated based on the rules specified in the task requirements. Hence, you should write a GameBoard class, based on the following:
  3. 1.  The creation of the board must be performed by an instance method called CreateBoard.
  4. 2.  CreateBoard should allow the user to input a number N, defining the size of the board (N rows by N columns).
  5. 3.  N should be integer, and smaller than 20. Otherwise, the method should ask the user to re-enter the size of the board.
  6. 4.  The method should then create a board represented as a bi-dimensional array of integers.
  7. 5.  The board should be filled with integer numbers, based on a rule that you must deduce from the following board examples.
  8. 6.  Once the board has been generated, CreateBoard must print it on the console.
  9. 7.  After completing the drawing, CreateBoard should prompt to the user a message asking if she wants to generate another board. If the answer is “YES”, then the user should be allowed to input another number, and a new board generation process should begin. If the answer is “NO”, then the application should be terminated. The system should reply to any other answer indicating that the answer provided is not valid, and asking again if the user wants to generate another board.
  10. 8.  The application Main method should create an instance of the class GameBoard, and then trigger the board generation process appropriately.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement