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

Research Directions: Create a Word or text document for your

Premium Paper Help is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.

When I joined Twitter 14 years ago, I was living

When I joined Twitter 14 years ago, I was living in Michigan’s Upper Peninsula, attending graduate school. I lived in a town of around 4,000 people, with few Black people or other people of color, not many queer people and not many writers. Online is where I found a community

Psychology Module 6 Personality Assignment (1 Page) Top of Form Bottom of Form Assignment Content Top of Form Introduction to Personality Theories

Psychology Module 6 Personality Assignment (1 Page) Top of Form Bottom of Form Assignment Content Top of Form Introduction to Personality Theories Introduction: The purpose of this assignment is to provide you with an understanding of personality theories, specifically the five-factor model. Personality theory helps inform psychologists’ approach to understanding

Psychiatric notes are a way to reflect on your practicum

  Psychiatric notes are a way to reflect on your practicum experiences and connect them to the didactic learning you gain from your NRNP courses. Focused SOAP notes, such as the ones required in this practicum course, are often used in clinical settings to document patient care. For this Assignment,

SMU Ethical Dilemmas Questions Nursing Assignment Help

Expert Solution Preview Introduction: As a medical professor responsible for creating assignments and evaluating student performance, it is crucial to ensure that the educational content provided challenges and enhances the knowledge and skills of medical college students. Through thoughtfully designed lectures, examinations, and assignments, the aim is to foster critical

Read the documents and information first, then follow all the

Read the documents and information first, then follow all the guidelines and answer all the questions. I need 10 sentences for each questions, you can use your creativity thinking give the solution on it or you can make a story. Do not plagiarize and you cannot use any references for

Building a Health History & Communication Techniques Essay Nursing Assignment Help

BUILDING A HEALTH HISTORY Effective communication is vital to constructing an accurate and detailed patient history. A patient’s health or illness is influenced by many factors, including age, gender, ethnicity, and environmental setting. As an advanced practice nurse, you must be aware of these factors and tailor your communication techniques

Summary of category strategy

It’s about Technical Gases to be used at petrochemical Industrial plant UNSPSC code 12142100) @ Middle East. Agenda: •      Demand analysis –      Category profile & requirements –      Spend & supplier panel ( General Layout and I will complete it) •      Sourcing plan development –      Cost drivers –      Key market supply

Legal, Safety, and Regulatory Requirements

Write the introduction for this paper. Write a 300 – 500 introduction that examines the effect of legal, safety, and regulatory requirements on the human resources process. Focus on at least 3 employee-related regulations established by the United States, such as the Department of Labor, the Americans with Disabilities Act

Emotional Intelligence and the Influence on Leadership Decision-Making

 In this assignment you are to take two assessments. These assessments will determine your emotional intelligence levels, leadership approach, and decision-making styles. These assessments are considered validated instruments which help you to understand your overall approach as a decision later. These assessments have been scientifically validated and will give you

Assignment 3 – Critical book review on Leadership: Students will

Assignment 3 – Critical book review on Leadership: Students will choose a book of their choice from the list of books on the leadership provided by the  instructor. The student will read the book in full. The student will then write a clear and concise  evaluation of the book, being

1. Give 10 examples and Name and Evaluate the spread

  1. Give 10 examples and Name and Evaluate the spread and control of these sexually transmitted infections. 2. Identify risk factors and outline appropriate client education needed in common sexually transmitted infections. 3. Describe how contraceptives can play a role in the prevention of sexually transmitted infections. 4. Analyze

Please respond to the following in 150 words or more:

Please respond to the following in 150 words or more:   A disaster can have varying effects on the psyche of the people that survive the incident. PTSD, Survivors Guilt, Acute Stress Disorder – every person reacts differently to these stressors and many issues with their own personal psyche may

Write a short, 300 word , reflecting on your internship

 Write a short, 300 word , reflecting on your internship and how it related to your executive masters program at  College.  As you prepare your paper, you might consider answering some of these questions: How did this internship help prepare you for future endeavors, both academically and in the workplace?