ENG Yachtzee punktiarvestus
Allikas: Lambda
- ImplementYachtzee game scoring program
- Any number of players
- Player score is entered "directly", withoud additional calculus
- For example: if a player hits quad 4, then you enter 16
- Alternatively one could enter 4 and the program would multiply 4x4 internally
- Program has to calculate "upper section" bonus points automatically
- Program must sum the player scores automatically and show it in the table
- Program has to mark the current leader
- With an * at the back of the score
- Table fields have to be with constant length
- which means - if the field score is 1 or 11, the column alignment would not be messed up
- Entering scores
- Choose a player to enter score to
- Choose the "trick" the points are awarded by
- Point for that trick
- Don't auto-rotate player turns
- You have to use classes and objects to hold in-memory data
- Use Checkstyle
- Upon which the main idea is to comment your source code
- Everybody has 0 pts. at the beginning of the game - don't mark the leader.
- If there are multiple leaders - players with same (high-) scores - you mark all of them as leaders
Example output:
name | 1 | 2 | 3 | 4 | 5 | B | T | Q | FH | LS | HS | Y | C | T --------+---+---+---+---+---+---+---+---+----+----+----+---+---+---- aadu | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 13* beedu | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 ceedu | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 ... | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 -> _
Incorrect column alignment:
name | 1 | 2 | 3 | 4 | 5 | B | T | Q | FH | LS | HS | Y | C | T --------+---+---+---+---+---+---+---+---+----+----+----+---+---+---- aadu | 10| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 23* beedu | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 ceedu | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 ... | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 12 -> _