Create a Tic-Tac-Toe game using FIFO (named) pipes as follows.

Create a Tic-Tac-Toe game using FIFO (named) pipes as follows. Note: Two processes (p1 and p2) must communicate via FIFO (named) pipe.  

  1. 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).
  2. p1 and p2 run at separate terminals on the same directory.
  3. p1 and p2 are responsible for displaying the game board and interacting with each player
  4. 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.
  5. p1 and p2 communicate to find which move the other player has taken.
  6. p1 and p2 are responsible for determining game progress statuses such as playing or game over with win, loss, or tie.
  7. When the game is over, p1 and p2 show if it has won, lost, or tied at its own terminal.
  8. Prompt user if they would like to play again,
  9. 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|
+-+-+-+

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

System Implementation Plan

Part 1 Examine the organization where you currently work, somewhere you have worked in the past, or a place where you would like to be employed in the future. Identify a need for an IT system to replace a paper/manual process or to upgrade an existing system. In your paper:

Read the article on Memorial Hospital during Hurricane Katrina: https://www.nytimes.com/2009/08/30/magazine/30doctors.html?smid=url-share

Read the article on Memorial Hospital during Hurricane Katrina:  https://www.nytimes.com/2009/08/30/magazine/30doctors.html?smid=url-share   Do you believe, after reading the circumstances, that the actions of the doctors and nurses meets the criteria of Euthanasia or murder? Do you think that there were alternative choices for the doctors and nurses, based on their experiences

Readings: Magretta, J. (2011). Understanding Michael Porter: The essential guide

   Readings: Magretta, J. (2011). Understanding Michael Porter: The essential guide to competition and strategy. Boston, MA: Harvard Business Review Press. (read Chapter 1, Competition: The Right Mindset, and Chapter 2, The Five Forces: Competing for Profits) Lafley, A. & Martin, R. (2013). Playing to win: How strategy really works.

Peer 1 When patients visit health care facilities, it is

  Peer 1 When patients visit health care facilities, it is usually the role of the medical staff to provide care for them. However, their role is not limited to providing medical attention to the patient it goes all the way to ensure that their client’s rights are not violated. They

Part Teardown Exercise – The Computer Mouse

 Part Teardown Exercise – The Computer Mouse Situation: You are a buyer at a major computer manufacturing company. Having recently been hired after graduating from the prestigious Portland Community College Supply Chain Management program, your management has decided to let you lead your own sourcing package in order to demonstrate

need someone very skilled with statistics and U.S English writing

  need someone very skilled with statistics and U.S English writing to write a 5-page paper following the instructions in the PDF document and using the Excel data set. This paper must be written in perfect native U.S. English with no spelling or grammatical errors. Also attached is a sample example

Strategic planning is used in organizations to define strategy, direction,

  Strategic planning is used in organizations to define strategy, direction, and capital allocation decisions. While, working capital management is used in companies to effectively manage a business by monitoring assets and liabilities to ensure that a company is operating efficiently. Please provide an example, the context and reasoning why

Dietary Guidelines for Diabetes Question Nursing Assignment Help

Instruct a Patient on Dietary Changes Instructions Review the resources on instructing patients. Select a disease of your choice. Research the disease dietary guidelines. Create an informational handout for patient education, teaching the patient how to eat properly for this/their disease. All of the information needs to fit on one

To begin, you will use the topic you selected in

To begin, you will use the topic you selected in the Week 1 Standard Form Arguments discussion forum and continued working with in the Week 2 Creating a Valid Argument Workshop assignment. For this assignment, you will present and evaluate reasoning from scholarly sources on both sides of your topic.

Instructions The purpose of this assignment is to allow you the

Instructions The purpose of this assignment is to allow you the opportunity to begin archiving your professional experience in the form of a resume. You will likely have to present a resume with your application for your future job. In this unit, you will begin thinking about what resume format

Students will practice completing a biopsychosocial assessment based on a

  Students will practice completing a biopsychosocial assessment based on a case scenario provided to them (see below).  The final project for this course will be to complete a biopsychosocial assessment with a child and their parent/guardian, this assignment is meant to provide an opportunity to practice an assessment before

1) Please discuss the importance of a systems team compromised

1)  Please discuss the importance of a systems team compromised of multiple disciplines. What are the pros and can you think of any cons? Practical examples would be great. 2)  What are some of the advantages and disadvantages of the four most common methods for gathering information for a systems

1. Choose two different organizations belonging to the same industry

1. Choose two different organizations belonging to the same industry (like STC & Mobily) and identify a problem that they are facing (you can use online sources for this). 2. If you are a researcher, how would you identify the issues and solve the problems for these two organizations (refer

In criminal justice, process and procedure are important. If proper

  In criminal justice, process and procedure are important. If proper discretion is not used, lives are affected and departments within criminal justice, such as the police, are affected as well. If improper discretion is used at any point during the process, there are consequences, and one of those consequences is the

choose your home state of residence, and Identify the location

  choose your home state of residence, and Identify the location of the state specific guidelines for medical record requirements for a physician office or a hospital by using the state statutes. Note, you may NOT use Findlaw as your resource. Identify the source of the information. Summarize the documentation

Do a brochure about cyberbullying. This is where you actually

Do a brochure about cyberbullying. This is where you actually CREATE and finish developing your resource in whichever medium you initially selected• Your resource will be evaluated based on:• Fit for selected audience• Obvious evidence base with correct information• Completeness of information provided• Utility (is it useful and user-friendly?)• Visual