THINK FIRST·CODE LATER

← All labs

Planning-poker round

Problem

Simulate one round of planning poker. The deck is 1 2 3 5 8 13 21.

Input: lines name vote until the end of input (each vote is a value from the deck).

Output:

  • If any vote is not in the deck: print Invalid vote from NAME: V for each such vote (in input order) and stop.
  • Otherwise print Votes: v1 v2 ... (in input order) and then:
    • if the highest and lowest votes are the same card or neighbouring cards in the deck (e.g. 5 and 8): Consensus: X, where X is the most frequent vote (on a tie, the higher value);
    • otherwise: Discuss: lowest L (names), highest H (names), names in input order separated by , .

Input:

Mei 5
Omar 8
Daniel 5
Aisha 5

Output:

Votes: 5 8 5 5
Consensus: 5

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.