FunctionRacerProblemsRace

Scoreboard by Rounds

BeginnerClassesPython, JavaScript, TypeScript, Java, C++

Implement a class RoundScoreboard that records points for a group of players, one round at a time. Write these methods:

name is always one of the players.

The tests call the methods in sequence and compare every return value. The expected list holds null for the constructor.

Example 1

RoundScoreboard(["kai","lu"])
add_round([3,5]) returns 1
add_round([4,0]) returns 2
total_for("kai") returns 7
total_for("lu") returns 5
last_round_for("lu") returns 0
best_total() returns 7

kai scores 3 and 4 for a total of 7; lu scores 5 and then 0, so the last round for lu is 0. The best total is 7.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Classes problems