Dowhat ask the player for their choice of action

This preview shows page 4 - 6 out of 13 pages.

dowhat Ask the player for their choice of action. purchased P : C : T P , T B , T Y , T R , T W P — Player who submits the ac- tion C — Card number (0 to 7) T ? — Number of each colour of token involved in the purchase Inform players that a card was purchased. took P : T P , T B , T Y , T R P — Player who submits the ac- tion T ? — Number of each colour of token taken Inform players that a player took tokens. wild P P — Player who submits the ac- tion Inform players that someone took a wild token. eog Inform player of end of game. Whenever player’s identity is communicated in messages, player 0 is indicated by ‘A’, 1 by ‘B’ and so on. Cards are treated as being in a sorted list, oldest to newest (oldest is the first card to be available face up). The card number references the position of the card in this list, with the oldest being 0 and the newest being 7. Players should check that messages are correct in structure, but they do not need to ensure that messages are correct as per game state. This means that if a message from the hub is of the correct structure and can be parsed, the player should accept this as a valid message and perform the appropriate action. Messages from players to the hub Encoded form Parameters Purpose purchase C : T P , T B , T Y , T R , T W C — Card number (0 to 7) T ? — Number of each colour of token used Purchase a card take T P , T B , T Y , T R T ? — Number of each colour of token taken Take tokens wild Take a wild token The hub should perform thorough checks of all messages received from players. For each message received, it should check that the structure is correct and can be parsed. Once this has been done, the hub should check that the action is valid in the context of the current game state. 4
Image of page 4

Subscribe to view the full document.

Prepared for s4257089. Do not distribute. Output The hub and players will print information explaining what is happening within the game while it is in progress. Output — hub The hub will print the following messages to standard out. Event Output to stdout Parameters Card added to market New card = Bonus D , worth V , costs T P , T B , T Y , T R D ∈ { P, B, Y, R } — The colour of dis- count this card gives V — Number of points this card is worth T ? — Number of each colour of token this card costs (can be zero) Player bought a card Player P purchased C using T P , T B , T Y , T R , T W P — Player letter C — Card number (0 to 7) T ? — Number of each colour of token used Player took tokens Player P drew T P , T B , T Y , T R P — Player letter T ? — Number of each colour of token used Player took a wild Player P took a wild P — Player letter Game ends early Game ended due to disconnect Game over Winner(s) L L — comma separated list of winners (sorted by player letter, smallest to largest) Eg. A,B,C Output — players After receiving each message, the players will send the following to standard error. Message Output to stderr Parameters eog Game over. Winners are L L — comma separated list of winners (sorted by player letter, smallest to largest) Eg. A,B,C dowhat Received dowhat For each other valid message received (except those in the table above), show the current game information: 1. Display each card in the market (in order oldest to newest, each on a new line):
Image of page 5
Image of page 6
  • Two '18
  • john
  • Playing card, players, player, The Players, Card game

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern