
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%

Transcribed Image Text:Introduction
This particular program implements a game called "Checkers" that is played in real life. For this
assignment, you should try to make your program look as nice as possible using the provided code
fragment.
Problem statement:
Write a C++ program that plays the game of Checkers. The game is simple and you can view the
instruction video online: https://www.youtube.com/watch?v=m0drB0cx8pQ
You can also find a simulation if you want to see the game in action. One specific online simulation is
at: http://www.csqnetwork.com/checkers.html
Set Up:
• Two players, one uses "x"s, the other uses "o"s.
• Checkers may be played on an 8x8, 10x10 or 12x12 square board.
• Command line arguments will be used to indicate the size of the board, for
example: ./checkers 8
• No matter the size of the board, pieces are placed on the dark squares of the board, leaving the
middle two rows blank. For example:
How to Play (Game rules):
• Players cannot move an opponent's piece.
• Turns alternate between players until the game is won.
• The player who runs out of pieces first or cannot make a valid move loses the game.
• Pieces may only move diagonally into unoccupied squares and only by one square if they are
not capturing a piece.
• A piece may capture opponent's pieces by jumping over them diagonally. So long as there are
successive pieces to be captured, the piece may continue moving. The line the piece travels
does not have to be straight along one diagonal, it may change directions so long as it
continues to progress the board and capture pieces.
When a piece has reached the King's Row (furthest row from it's originating side) then it is
"kinged" by placing a second token on top of it (You may use "X"s or "O"s or any other
distinguishable symbols to indicate "kinged" pieces). This piece is now permitted to move
backwards on the board and allowed to capture backward.
![Implementation Requirements:
Establish the size of the board via command line arguments, must include error handling for
too many and too few arguments as well as incorrect input. If an invalid size is provided, then
the program should display a message to indicate the problem, and recover by asking for the
size during runtime.
• The board must be created using two-dimensional, dynamic memory.
• The board must be correctly colored black and white using the following code as a base. The
following code fragment colors a two-dimensional board. It is expected that you will adjust it as
needed to provide the best user interface possible for your program.
for (int i=0; i<rows; i++)
{
for (int j=0; j<cols; j++)
if (i % 2 ==
O && j % 2 == 0)
cout « "I\033[30;47m " « board[i] [j] « " ";
else if (i % 2 == 1 &&j % 2 == 1)
cout « "I\033[30;47m " « board[i][j] « " ";
else
cout « "I\033[ Om " << board[i] [j] « " ";
%3D
cout « "\033[0m";
cout « endl;
The game must be correctly set up and played as described in the "Set Up" and "How to Play"
sections of this document.
The path of travel shall be received as a single, c-style string, and correctly parsed and error
handled to move the pieces in a correct fashion on the board. The string should be a list of
square coordinates. It is up to you as the programmer to determine the best delimiter and
coordinate system to use. Whatever method that is chosen should be clearly communicated to
the user.
The board should be printed after each move of a piece and include the defined coordinate
system. This is especially important for a piece that may move multiple squares in a turn.
• After each move, captured pieces should be removed from the board.
• When the move sequence of a turn has been completed, the total number of captured pieces for
each player should be displayed.
• If a piece makes the King's Row then it should be "kinged" in some way. Kinged pieces are the
only pieces which may move forwards and backwards on the board.
The game should end when only one color of piece remains on the board or if a player has run
out of valid moves.
If there is a winner, the program must immediately declare the winner and ask if the player(s)
want to play again (you may use the same board size or a different one by asking for user input).](https://content.bartleby.com/qna-images/question/8759b09c-a99c-4616-917a-1eb84cf5071d/08c7a589-fbca-42e2-ab9f-dba327621a9c/rbajy9p_thumbnail.jpeg)
Transcribed Image Text:Implementation Requirements:
Establish the size of the board via command line arguments, must include error handling for
too many and too few arguments as well as incorrect input. If an invalid size is provided, then
the program should display a message to indicate the problem, and recover by asking for the
size during runtime.
• The board must be created using two-dimensional, dynamic memory.
• The board must be correctly colored black and white using the following code as a base. The
following code fragment colors a two-dimensional board. It is expected that you will adjust it as
needed to provide the best user interface possible for your program.
for (int i=0; i<rows; i++)
{
for (int j=0; j<cols; j++)
if (i % 2 ==
O && j % 2 == 0)
cout « "I\033[30;47m " « board[i] [j] « " ";
else if (i % 2 == 1 &&j % 2 == 1)
cout « "I\033[30;47m " « board[i][j] « " ";
else
cout « "I\033[ Om " << board[i] [j] « " ";
%3D
cout « "\033[0m";
cout « endl;
The game must be correctly set up and played as described in the "Set Up" and "How to Play"
sections of this document.
The path of travel shall be received as a single, c-style string, and correctly parsed and error
handled to move the pieces in a correct fashion on the board. The string should be a list of
square coordinates. It is up to you as the programmer to determine the best delimiter and
coordinate system to use. Whatever method that is chosen should be clearly communicated to
the user.
The board should be printed after each move of a piece and include the defined coordinate
system. This is especially important for a piece that may move multiple squares in a turn.
• After each move, captured pieces should be removed from the board.
• When the move sequence of a turn has been completed, the total number of captured pieces for
each player should be displayed.
• If a piece makes the King's Row then it should be "kinged" in some way. Kinged pieces are the
only pieces which may move forwards and backwards on the board.
The game should end when only one color of piece remains on the board or if a player has run
out of valid moves.
If there is a winner, the program must immediately declare the winner and ask if the player(s)
want to play again (you may use the same board size or a different one by asking for user input).
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

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.Similar questions
- Directions: Write a program that will perform a casino game using C. Provide comments in the codeexplaining everything. See above deliverable instructions. Requirements: A menu will first appear asking the user to choose which game they would like to play. The userwill be able to choose between blackjack and roulette.The blackjack game will only play one hand at a time against the dealer. If the dealer and the user have the same,then it’s a draw. If you do not know how to play blackjack, then you might need to research the game.The roulette game will ask the user what numbers they would like to bet on. If the random number is chosen, thenthe user wins.Each game should ask the user how much money they would like to bet before the game starts. The user shouldhave a starting amount of money, once the user loses their money, the user will then need to stop playing. Expert Solutionarrow_forwardflow chart and dimple program. Python thank youarrow_forwardMay assignment is asking me to build a program in PyChart that makes it possible for the player to visit each room and select the items in that room to fight a giant at the end. In order to win the game you have to collect all of the items from all of the rooms. When I run the code this is the result: Text Adventure Game ***************************Welcome to the Giant text game, Collect all of the items to defeat the Giant!To move: South, North, East, WestTo get items: get ’item name’ ***************************You are in the BasementItem: You see ArmorEnter a move: When I input the direction to go north the next result comes up correctly. However when I tell it to get and item (which is the command written into the code I get this: Invalid direction! Please enter a valid direction. ***************************You are in the BasementItem: You see ArmorEnter a move: This is my complete program code, can someone please tell me what I am doing wrong. #Functions showing goal of game and…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education