Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 2: Create in Linux/Unix using C/C++ a program to play tic-tac-toe. Overview Tic-tac-toe or Xs and Os is a paper-and-pencil game for two players

image text in transcribed

Lab 2: Create in Linux/Unix using C/C++ a program to play tic-tac-toe. Overview Tic-tac-toe or Xs and Os is a paper-and-pencil game for two players who take turns marking the spaces in a three-by-three (or in general an nn ) grid with X or O. The player who succeeds in placing three (or n ) of their marks in a horizontal, vertical, or diagonal row is the winner. Instructions Write a computer program which takes its input (see size of the grid) from the command line and using shared memory the two opponents are played by two different processes. Notes - The grid size should be provided as command line argument. - The players will read the coordinates from the standard input (usually keyboard). - Whoever is creating the shared memory is responsible to print on regular basis the content of the grid (i.e. after each new step). - Whichever process wins the game will write that it's the winning process, while the other will write that it's the process who lost the game. In case of a draw, both process should write the outcome (see draw). - The processes should be different programs and should not be necessarily created using fork(). - If fork() is to be used for the implementation and the game will happen between the child and the parent process the maximum grade will be 9/10 (see rubric below). - System functions such as ftok(), shmget(), shmat(), shmdt() and shmctl() are encouraged to be considered to create and handle the shared memory between the processes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

More Books

Students also viewed these Databases questions