Question: 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

 Lab 2: Create in Linux/Unix using C/C++ a program to play

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!