Creating a TicTacToe with c or c Do and implement on UNIX. | Quick Solution

There is a variation of Tic-Tac-Toe that is on a 5×5 grid. Players take turns
placing X’s and O’x in empty squares on the grid. The player that connects
4 consecutive X’s or O’s wins the game. If the board is full and no player has
connected 4 consecutive X’s or O’s then the game ends in a tie. Assume that
player 1 has the X’s and player 2 has the O’s.
In this assignment you are to implement a multi-process application that
has one main (parent) process and creates three child processes, The purpose of
the main process is just to create a shared memory segment (game board), and
semaphores. The three children processes will be: one referee, and two others to
play the game. The only problem here is that processes do not have to take turn,
they rather contend for the board. This means that a player can go two times in a
row if that player can access the board game before the other. It is OK for
this game to be unfair if taking turns doesn’t happen (starvation is a risk).
This is a different version of the producer consumer problem where the producer
produces a game board (5×5) and a single integer indicating if a winner has
been found or not. The scenario of running the program goes as follows:
1. The producer produces an empty game board, and indicates that no winner
has been assigned and play may resume.
2. A process will only access the board game if it has been released by the
producer and also if no winner has been announced and the play may resume.
3. After a player makes a move (based on generating 2 random numbers between 1
and 5), the player process should indicate to the referee that it’s time
to check for a winner. The two random numbers represent the row and the column
where the X or the O is to be placed.
* The player should print the game board after making the move
4. The referee process will check to see if there’s a winner, and if so, it
will announce it and end the game. Otherwise, it will indicate that no
winner has been found and play may resume.
* The referee should either announce a winner or indicate, no winner found
and play should resume.
5. Once play resumes and no winner has been found, the next available
process may take control, insert a chip, and once again indicate to the
referee it is time to check.
* The player should print the game board after making the move
STEPS 4 and 5 are repeated until a winner is announced or the game ends in a
tie.
Useful Functions (You may or may not use all of them):
fork, semget, semop, semctl, shmget, shmat, shmdt.
You are expected to implement this assignment on UNIX using C or C . Submit
all your source code in a zip file with instructions on how to run the code
and how to compile it.
Do use C or C and implement on UNIX.

Don't use plagiarized sources. Get Your Custom Essay on
Creating a TicTacToe with c or c Do and implement on UNIX. | Quick Solution
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay
superadmin

Recent Posts

What is the easy difination of science | Quick Solution

Science is the pursuit and application of knowledge and understanding of the natural and social…

3 years ago

definition, values, meaning of such values and type of goods with such elasticity value …….. | Quick Solution

Clearly stating the definition, the values, the meaning of such values and the type of…

3 years ago

Acct 422 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago

Acct 322 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago

Macro Economics Question | Quick Solution

https://www.npr.org/sections/ed/2018/04/25/605092520/high-paying-trade-jobs-sit-empty-while-high-school-grads-line-up-for-university Click on the link above. Read the entire link and answer the questions below…

3 years ago

MGT 322 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago