Question: 2 player 1 d game in c coding language, The game is played on a single row of 8 positions. Each player has three pieces:

2 player 1d game in c coding language, The game is played on a single row of 8 positions. Each player has three pieces: a king, a knight, and a rook. White's pieces are on the left; Black's pieces are on the right.
The initial positions of the pieces are as follows:
The initial positions of the pieces: white king, white knight, white rook, empty, empty, black rook, black knight, black king.
Since we're using a text-only Terminal for output, you'll need to represent the board using characters. For example: WK WN WR ____ BR BN BK, or perhaps use uppercase and lowercase letters to indicate white/black.
Game Play
A player chooses one of their pieces to move on their turn. A piece may not move to a space that is occupied by a piece of its own color. When a piece moves to a space occupied by an enemy piece, the enemy piece is captured, i.e., removed from the board.
A king may move one space left or right.
A rook may move to any space as long as every space between the departure and destination spaces is unoccupied.
A knight moves two spaces left or right, regardless of whether there is a piece between the departure and destination spaces.
There is no castling.
A king is in check if either (1) there are only empty spaces between it and the enemy rook or (2) the opponent's knight is two spaces away from it. At the end of a player's turn, their own king must neither be in check nor next to the enemy king. If a player's king is in check and cannot get out of check, then it is checkmated and the player loses.
Stalemate occurs if a player has no legal moves but their king is not in check. A draw by insufficient material occurs when all non-king pieces have been captured. When your program is run, please display the name of the game and a brief set of instructions. Make sure you explain how to move (that is, what the inputs should look like) and how to win the game. Think about what it would look like to someone who didn't know the rules of the game and how to play. However, keep it brief; just a few sentences will do.
As stated earlier, your program should play a single game and then exit.

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 Programming Questions!