Question: Task 1 : Displaying the Game Board In this task you will develop a program to display to the screen a text - based representation
Task : Displaying the Game Board
In this task you will develop a program to display to the screen a textbased representation of the state of the board midway through a game of Graze. Your program will take as an input argument a string of characters that represent the current state of each square of the board.
Implementation details
Board Coordinates
To facilitate in a computerbased version of Graze in a terminal environment, a set of coordinates can be setup to represent the different playing positions on the board. The board rows are represented by numbers and columns by the letters abcd:
Using this system, player s first move above would be b and player s first move would be c
Displaying the board:
You program should display the current state of the board using printf statements in the following form:
abcd
where the "abcd" indicate the board columns, indicate the board rows, and represents playableempty board positions. Any board positions that are occupied by player or player s tokens should be indicated by the symbols Xfor player and Ofor player For example, the board position:
Would be printed to the screen as:
abcd
X
X
OOO
X
Program Input
Your program should run with the following format:
displaygrazeboard
where is a character long string that indicates the board state, represented by numbers, where represents an empty square, represents one of player s tokens, and represents one of player s tokens. The string should provide the characters in the order: bcabcdabcdbc ie rowbyrow, top to bottom eg:
displaygrazeboard
should produce the output board:
abcd
XX
OO
O
For Task you can assume that the input string will be provided without errors ie automated test cases will always provide valid board state strings however you might like to run some simple error checking within your code.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
