rogramming. Could you make sure the output looks like figure2, 3, and 4. Please attach a picture of the code. Thanks

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
C Programming. Could you make sure the output looks like figure2, 3, and 4. Please attach a picture of the code. Thanks!
OTHELLO GAME
LL
LL
LL
LL
LL
0000 TTTTTT HH HH EEEEEE LL
00 00 TT
00 00 TT
00 00 TT
0000 TT
HH HH EE
HHHHHH EEEE
HH HH EE
LL
LL
HH HH EEEEEE LLLLLLL LLLLLL 0000
0000
00 00
00 00
00 00
RULES:
1. A square 8 x 8 board
2. 64 discs colored black (X) on one side and white (0) on the opposite side.
3. The board will start with 2 black discs (X) and 2 white discs (0) at the center of the board.
4. They are arranged with black (X) forming a North-East to South-West direction. White (0) is forming a North-West to South-East direction
5. The goal is to get the majority of color discs on the board at the end of the game.
6. Each player gets 32 discs and black (X) always starts the game.
7. The game alternates between white (0) and black (X) until one player can not make a valid move to outflank the opponent or both players have no valid moves.
8. When a player has no valid moves, they pass their turn and the opponent continues.
9. A player cannot voluntarily forfeit their turn.
10. When both players can not make a valid move the game ends.
Hit <ENTER> to continue!
Figure 1 Welcome screen function output
Player X, please enter your name
Figure 2 Player X name
Player X, please enter your name
Karin
Player 0, please enter your name
Figure 3 Player O name
Player X, please enter your name
Karin
Player 0, please enter your name
Lia
Karin and Lia, let's play Othello!
Figure 4 let's play Othello
Transcribed Image Text:OTHELLO GAME LL LL LL LL LL 0000 TTTTTT HH HH EEEEEE LL 00 00 TT 00 00 TT 00 00 TT 0000 TT HH HH EE HHHHHH EEEE HH HH EE LL LL HH HH EEEEEE LLLLLLL LLLLLL 0000 0000 00 00 00 00 00 00 RULES: 1. A square 8 x 8 board 2. 64 discs colored black (X) on one side and white (0) on the opposite side. 3. The board will start with 2 black discs (X) and 2 white discs (0) at the center of the board. 4. They are arranged with black (X) forming a North-East to South-West direction. White (0) is forming a North-West to South-East direction 5. The goal is to get the majority of color discs on the board at the end of the game. 6. Each player gets 32 discs and black (X) always starts the game. 7. The game alternates between white (0) and black (X) until one player can not make a valid move to outflank the opponent or both players have no valid moves. 8. When a player has no valid moves, they pass their turn and the opponent continues. 9. A player cannot voluntarily forfeit their turn. 10. When both players can not make a valid move the game ends. Hit <ENTER> to continue! Figure 1 Welcome screen function output Player X, please enter your name Figure 2 Player X name Player X, please enter your name Karin Player 0, please enter your name Figure 3 Player O name Player X, please enter your name Karin Player 0, please enter your name Lia Karin and Lia, let's play Othello! Figure 4 let's play Othello
Write the function playGame to do the following
a. Return type void
b. Empty parameter list
c. Declare the following variables
i. playerX, data type character array size 20 (i.e. use
macro NAME); used to store the player's name that
will be player X
ii. playerO, data type character array size 20 (i.e. use
macro NAME); used to store the player's name that
will be Player O
iii. currentPlayer, data type integer; initialize to 1
(i.e. use macro PLAYER_X); ; used to keep track of
the current player
iv. loop, data type integer; initialize to 0 (i.e. use
macro ZERO); used to control the number of loop
iterations
v. Write a printf statement to prompt player X to enter
their name
vi. Write a scanf statement to store player X's name in
variable playerX
vii. Write a printf statement to prompt player O to
enter their name
viii. Write a scanf statement to store player O's name
in variable player O
ix. Write a printf statement using the entered player
names to play Othello
x. Write a while loop to iterate four times (i.e. use
macro FOUR)
1. Call function display ExplicitBoard
2. If the current player (i.e. currentPlayer) is
Player X (i.e. PLAYER_X)
a. Write a printf statement to tell Player X
it is their turn
b. Switch players by setting current
player to Player O
3. If the current player (i.e. currentPlayer) is
Player O (i.e. PLAYER_O)
a. Write a printf statement to tell Player O
it is their turn
b. Switch players by setting current
player to Player X
4. Call function system(), pass as an argument
explicit text "pause" (i.e. must include
double quotes) to pause the console output
5. Increment the loop control variable (i.e. loop)
by one
Transcribed Image Text:Write the function playGame to do the following a. Return type void b. Empty parameter list c. Declare the following variables i. playerX, data type character array size 20 (i.e. use macro NAME); used to store the player's name that will be player X ii. playerO, data type character array size 20 (i.e. use macro NAME); used to store the player's name that will be Player O iii. currentPlayer, data type integer; initialize to 1 (i.e. use macro PLAYER_X); ; used to keep track of the current player iv. loop, data type integer; initialize to 0 (i.e. use macro ZERO); used to control the number of loop iterations v. Write a printf statement to prompt player X to enter their name vi. Write a scanf statement to store player X's name in variable playerX vii. Write a printf statement to prompt player O to enter their name viii. Write a scanf statement to store player O's name in variable player O ix. Write a printf statement using the entered player names to play Othello x. Write a while loop to iterate four times (i.e. use macro FOUR) 1. Call function display ExplicitBoard 2. If the current player (i.e. currentPlayer) is Player X (i.e. PLAYER_X) a. Write a printf statement to tell Player X it is their turn b. Switch players by setting current player to Player O 3. If the current player (i.e. currentPlayer) is Player O (i.e. PLAYER_O) a. Write a printf statement to tell Player O it is their turn b. Switch players by setting current player to Player X 4. Call function system(), pass as an argument explicit text "pause" (i.e. must include double quotes) to pause the console output 5. Increment the loop control variable (i.e. loop) by one
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
ListBox
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education