Remember: your
programming assignment must be turned in online.
The goal of this assignment is to get familiar with the Interprocess Communication using pipes.
In this assignment, you are to report the moves and the result of 10 tic-tac-toe matches between the parent and its three children.
You first need to create three child processes of the main process, call them 'ch1', 'ch2' and 'ch3' such that the parent can communicate with each of the children using half-duplex pipes. Now parent plays tic-tac-toe simultaneously with each of its children (in parallel). The rules of the game are as follows :
Both the parent and the child communicate their moves to each other through a pipe. Each child also outputs all moves of its games to a file as they occur(both the parent moves and its own moves). There are to be three files for this output: ch1games, ch2games and ch3games. The structure of the report of each move has the following syntax.
You need to report 10 matches between the parent and each child. So a total of 30 matches should be reported, 10 in the file corresponding to each child. You are free to use any valid 'C' standard library or UNIX system function calls for this assignment.
For extra credit, instead of using the three children files for reporting moves, have each player besides sending its move to its opponent over a pipe also output its move to the standard output. You can see that there would be synchronization issues among the players while reporting the moves to the standard output. You don't want the contents of two or more move reports inter-mixed. You might like to use Semaphores to avoid it. ;-)
Your code, a working makefile,
output files of the two children and your design document. In addition, include
a README file to explain
anything unusual to the TA — testing procedures, etc.
REMEMBER: Do not submit
object files, assembler files, or executables. Every file in the submit
directory that could be generated automatically by the compiler or assembler
will result in a deduction from your programming assignment grade.