Creating a TicTacToe with c or c Do and implement on UNIX.
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.
We've got everything to become your favourite writing service
Money back guarantee
Your money is safe. Even if we fail to satisfy your expectations, you can always request a refund and get your money back.
Confidentiality
We don’t share your private information with anyone. What happens on our website stays on our website.
Our service is legit
We provide you with a sample paper on the topic you need, and this kind of academic assistance is perfectly legitimate.
Get a plagiarism-free paper
We check every paper with our plagiarism-detection software, so you get a unique paper written for your particular purposes.
We can help with urgent tasks
Need a paper tomorrow? We can write it even while you’re sleeping. Place an order now and get your paper in 8 hours.
Pay a fair price
Our prices depend on urgency. If you want a cheap essay, place your order in advance. Our prices start from $11 per page.