Question: Question 4 (30marks) This question covers materials up to Seminar 5, excluding File. Apply data structures to store and process information and solve computational problems

 Question 4 (30marks) This question covers materials up to Seminar 5,excluding File. Apply data structures to store and process information and solvecomputational problems using structured programming. The XO domino-tile game is played by

Question 4 (30marks) This question covers materials up to Seminar 5, excluding File. Apply data structures to store and process information and solve computational problems using structured programming. The XO domino-tile game is played by 2 players using a square board. Players take turns to enter the coordinates of 2 EMTPY squares (row-col, row-col) to place their domino-tiles, until there is no possible move. We will illustrate the game using a 5x5 square board. SINCLUNAER LNIVERSIT CE SOCHAL. SCIEVCES (susS) Page 3 of 14 XCT133 Tuter-Marked Assignement Employ structured programming to develop this game with the following playing rules: - At start of the game, prompt for the following: - Two unique names representing the of 2 players. - Size of the game board, that must be odd number and at least 3. - The computer randomly decides which player to start and will take the symbol X. The other player will take the symbol O. - Each player in tarn will place a domino-style tile that occupy 2 EMTPY squares. - Your program must validate the 2 squares that the player wanted to place the next tile. In the above board, if a player enters 0010 for his next tile, it is invalid as 00 is already occupied. - In the above board, if a player enters 1112 for his next tile, it is invalid as 12 is already occupied. - If player enters 2132 for his next tile, it is invalid as the 2 squares are not connected vertically or horizontally. - Game ends when no player can place any more tile. - Player with the most tiles on the board wins. - If the result is a tie, repeat the game until a winner can be determined. Sample program executions are as follows: Tage D of 14 ICT133 Tuter-Marked Assignment Create the following functions as building blocks for the XO domino-tile game program: - getNewBoard(size: int): list - This function should create and return a nested list based on the given parameter sise, representing an empty game board. (Hint: each empty square is defaulted t0) - printBoard(board: list) - This function displays the current game board, showing placed tiles' location through ' X ' and ' O '. - getNextTile(playerName: string, symbol: string, size- int): string, string - This function prompts the player to enter the 2 squares to place the next domino-tile. - This function will validate and return the 2 squares (as 2 strings) if they are within the game board. Otherwise, the function will prompt the player to re-enter the 2 squares. - validateTile(squarel: string, square2: string, size- int): Boolean 0 This function takes in 3 parameters: squarel, square2 (e.g. '00', 011 ) and the size of the board. The function should return True if the given square1 and square2 can form a valid domino-tile. Otherwise, returns False. For example, - vulidate tiler 00;, 0I;, 5) returns True - validateTile ('00; '20;,5) returns False - validateTile ( 00;,11,5) returns False - place Tile(board- list, symbol: string, square l: string, square2: string): Boolean - This function returns True if squarel and square2 can be updated with the given symbol. In other words, square1 and square 2 are empty for the next tile to be placed. Rage 12 of 14 ICT133 Tuter-Marked Assignewnt - The function returns False if either squarel or square 2 are not empty. - isGameAlive(board: list): Boolean - This function should look through the board and return True if there are still 2 vertically linked or horizontally linked EMPTY squares on the board to allow the next domino-tile to be placed. Otherwise, returns False. You will need to code other functions to complete the program. Paste sereenshots of game play that covers these scenarios: - Player entering wrong coordinates (not empty, wrong row/column etc.) - Player wanted to place next tile in occupied square(s). - Game finishes with a winner. - Game repeats when the result is a tie. - Game with a different game board size. ( 30 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!