rogramming. Could you make sure the output looks like figure2, 3, and 4. Please attach a picture of the code. Thanks
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7d4fd4d4-77c7-4e93-950b-25099f54e660%2F5d477241-f681-41ad-8111-8f70ffe69d67%2Fcnyrg5o_processed.jpeg&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7d4fd4d4-77c7-4e93-950b-25099f54e660%2F5d477241-f681-41ad-8111-8f70ffe69d67%2Famirka_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
Step 1
Program Approach:
1- As mentioned in the assignment output look like 2, 3, and 4.
2- Create a header file name as stdio.
3- stdio means input and output features.
4- Define a method as the main.
5- Inside the main method create the variable as the name.
6- Prompt a message to take input from a user.
7- Store the user input to the name variable.
8- In the last display the output on the screen.
9- Please check the following complete example and three output screenshots.
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
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)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education