Create a Tic-Tac-Toe game using FIFO (named) pipes as follows. Note: Two processes (p1 and p2) must communicate via
Create a Tic-Tac-Toe game using FIFO (named) pipes as follows. Note: Two processes (p1 and p2) must communicate via FIFO (named) pipe.
- Create two programs that communicate via FIFO pipes.
- p1 is for player 1 which plays with "O".
- p2 is for player 2 which plays with "X".
- You may assume p1 always plays first (for simplest's sake in implementation).
- p1 and p2 run at separate terminals on the same directory.
- p1 and p2 are responsible for displaying the game board and interacting with each player
- p1 and p2 are responsible for validating inputs from the player. Input validation includes:
- selection of the location to play (0 ~ 8)
- validation of input data: a digit and available locations (empty cells) only.
- p1 and p2 communicate to find which move the other player has taken.
- p1 and p2 are responsible for determining game progress statuses such as playing or game over with win, loss, or tie.
- When the game is over, p1 and p2 show if it has won, lost, or tied at its own terminal.
- Prompt user if they would like to play again,
- If both p1 and p2 reply with Y (yes), the game starts over again instead of terminating the program.
At the initial screen: Instead of zero(0), a dot(.) is displayed to avoid confusion with O. However, the user enters 0 (zero) to select the location.
+-+-+-+
|.|1|2|
+-+-+-+
|3|4|5|
+-+-+-+
|6|7|8|
+-+-+-+
As O/X's have been played in some locations, digits or . are replaced by O's and X's. The below board shows O has placed at cell locations 0, 1, and 8 while X has played at cell locations 4 and 6.
+-+-+-+
|O|O|2|
+-+-+-+
|3|X|5|
+-+-+-+
|X|7|O|
+-+-+-+
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.