Reference no: EM132377141
Assignment -
Purpose - In this assignment, you will write a group of three C99 programs to play a game. One of the programs will be called 2310hub it will control the game. The other two programs (2310alice and 2310bob will be players).
The hub will be responsible for running the player processes and communicating with them via pipes (created via pipe ()). These pipes will be connected to the players' standard ins and outs so from their point of view communication will be via stdin and stdout.
If some of the required programs compile and some do not, there will still be some marks allocated to each component working independently (see the marking section for more information).
Other than the hub starting player processes, there should not be any other parallelism used in this assignment. For example, no multi-threading nor non-blocking operations. Your programs are not permitted to start any additional processes nor are your programs permitted to create any files during their execution.
Your assignment submission must comply with the C style guide (version 2.0.4). It must also not use banned functions or commands listed in the same place.
Game -
What follows is an abstract description of the game. Precisely what your programs need to output will be described separately.
The game consists of:
Players (P of them): who are positioned in a circle. One player is labelled 0 and the remaining players are numbered in clockwise order.
A deck of cards (d of them) containing no duplicates. Each card in the deck has:
- A suit from {S, C, D, H}
- A rank (in hexadecimal) from 1 . . . 9, a . . . f.
A threshold (T)
At the start of the game, each player is given a "hand" of H = VA cards (ie rounded down). That is, the first H cards in the deck are given to Player 0, the next H cards are given to Player 1, etc. Each player tracks:
- Their points (S)
- The number of cards with the 'D' suit, played in rounds which they won (V).
D cards are worth -1 points at the end of the game unless the player won at least T of them. In which case, they are worth 1 point each.
1. The game is played in H rounds (one card per round).
2. The lead player for each round is:
- Player 0 in the first round.
- The player who won the previous round for all other rounds.
3. The lead player plays one of the cards from their hand. The suit of this card is the "lead suit".
4. The other players, in clockwise order from the lead player, play one card from their hands:
(a) If they have any cards belonging to the lead suit, then they must play one of those.
(b) Otherwise play any card
5. Find the highest ranked card of the lead suit. The player who played that card:
- gets 1 point/ (ie increases S)
- is the lead player for the next round.
- records how many D cards were played that round. (ie increases that player's V value)
6. When all rounds are complete, each player's score is
- S - V if V < T
- S + V if V ≥ T
Deck file format -
The first line of the deck file will contain a single int indicating how many cards are in the deck. The remaining lines (each ended by '\n') contain two chars, the suit and the rank of the card.
Note - Want you to make this code for me on C language which can run on Linux. Want you to make the code from scratch which you have never made for any one so that no similarity can be found or don't give this code to anyone else.
Attachment:- Assignment File.rar