In the game of �Unique�, multiple players privately choose an integer. They then reveal
their choice. The winner is the player who chose the smallest unique number. The
game is considered a draw if no unique integer was chosen.
You would write a program that simulate such a game according to the followings
- The parent process fork player (child) processes (up to maximum of 10
players). It then waits for each of the child processes to return an integer. - The players (child processes) will randomly pick an integer between 1 to 5, and
return the choices to the parent. - Parent process determines the winner based on the choice returned by the
players (child processes). Parent process then print out the winner�s PID and
inform all child processes to terminate, before it terminates. If it is a draw, parent
process shall inform all the child processes (players) to choose another integer. - Repeat steps 2 and 3 as many times as required until a winner can be
determined.
Example of output:
$ ./game 5
Game starts with 5 players
Player 3312 choose 4
Player 3314 choose 3
Player 3313 choose 2
Player 3315 choose 1
Player 3316 choose 5
Player 3315 win!
Please help me, to write a code because I am totally new in shell programming