Project 1: Tic-Tac-Toe game Create a Tic-Tac-Toe game using FIFO

Project 1: Tic-Tac-Toe game

Create a Tic-Tac-Toe game using FIFO (named) pipes as follows. Note: Two processes (p1 and p2) must communicate via FIFO (named) pipe. If not, no credits will be given. 

  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 (draw).
  7. When the game is over, p1 and p2 show if it has won, lost, or tied at its own terminal.

The game board at each terminal should be displayed as follows. Use the combination of + – | to draw the game board.

At the initial screen: Instead of zero(0), a dot(.) is displayed to avoid confusion with O (letter Oh). 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

Chapter 8 is called, “Economics” and it discusses what we

Chapter 8 is called, “Economics” and it discusses what we are refer to  commissary. In the book it is called, the canteen. It also explain the 3 ways prisoners can use their funds that are controlled by the government.  It also discussed how prisoners had their own underground economic system

The panda helper apk app store contains thousands of applications

The  panda helper apk  app store contains thousands of applications for iOS and Android devices. These apps range from games to third-party apps and even include extensions and themes. You can download free versions of many apps or pay for them to unlock premium features. There are many advantages to

Case Analysis: Rick’s New Job DUE TOMORROW JUNE 27 before

Case Analysis: Rick’s New Job DUE TOMORROW JUNE 27 before 12 Midnight CST Read the Rick’s New Job case analysis at the end of Chapter 3 of the Blanchard and Thacker (2019) text. In a three-to-four-page paper (excluding the title and reference pages), respond to the following case questions: Explain

Question I – The appellate court decides that the trial

Question I – The appellate court decides that the trial court committed reversible error by including evidence found by law enforcement.  Law enforcement discovered this evidence when committing a Fourth Amendment violation, which should have been excluded at trial.  This inadmissible evidence was the lynchpin of the prosecutor’s case, which

Please fill in the required spaces on the attached leanstack

  Please fill in the required spaces on the attached leanstack Continue with your LeanStack and produce three different ideas that solve your  identified problem (mandatory COVOD testing) – these are your solutions and go in the Solutions section (remember to keep the consumer in mind as this is not about you).

In 150-250 words, give a synopsis of the current level

In 150-250 words, give a synopsis of the current level of practice and practice climate for APRNs in California.  Incorporate what you have learned from the Buppert readings, and from investigating your state BRN website.  If yours is a full practice state, discuss how your state adopted full practice authority

400 words Provide a brief history of scenario planning in

 400 words   Provide a brief history of scenario planning in general. Describe an overview of the scenario planning process. Who is responsible for scenario planning within the organization? Provide a few examples of real scenario planning within corporations. Provide a brief history of scenario planning in general. Describe an

Identify two classroom management models and two campus wide behavior

  Identify two classroom management models and two campus wide behavior management systems. Some examples of models and systems are listed below or you can chose others as appropriate. For each of the models and systems selected, write 100-150 words comparing and contrasting the model or system, and identifying the

VIDEO: Supreme Court rules for Alabama death row inmate

 VIDEO: Supreme Court rules for Alabama death row inmate – YouTube [3/5/19] – Supreme Court Rules in Favor of Death Row Inmate with Dementia The U.S. Supreme Court sent a death-row case back to the lower courts on February 27th, ruling in favor of Vernon Madison, a death row inmate

Unit 5 Assignment: Current Events Article Reflection Attached Files: Current

  Unit 5 Assignment: Current Events Article Reflection Attached Files: The New York Times is a great resource for finding current events articles about Psychology.  For this assignment, you will choose a New York Times article from the provided options, and write a 3-page reflection paper on the article.  See

what is your reactions the video brought up for you

what is your reactions the video brought up for you –  positive or negative. This could be anything including but not limited to: emotions it brought up  in you, something that struck you about an individual or individuals who were profiled in the  video, memories of people you know who

1-How has operations management changed since its early days as

 1-How has operations management changed since its early days as scientific management?  2-  What are the differences between Lean and Six Sigma? What are the similarities? Would you like to see both in your organization? Why or why not?   3- What job-sequencing rule do you see most often in healthcare?

KEVIC Leadership in Organizational Settings Questions Nursing Assignment Help

Find two ads for management or executive positions (Copy and paste them). What leadership attributes (competencies) are mentioned in these ads? (There are eight [8] listed in Chapter 12, p. 460). Personality Self-concept Leadership Motivation Drive Integrity Knowledge of the Business Cognitive Intelligence (IQ) and Practical Intelligence Emotional Intelligence (E.Q.)