After reading Sections 9.6.2 and 9.6.3, write constraints for a RoundRobinStyle class and a RoundRobinRound class, implementing the TournamentStyle and the Round interfaces, respectively. Assume that RoundRobinStyle plans a series of Rounds so that each Player is paired with the other Players exactly once in the Tournament. Note that the number of Rounds depends on whether the number of Players in the Tournament is odd or even, and that a given Player cannot play more than once in a given Round.

What will be an ideal response?

```
/* If the number of players is even, the number of rounds is one less than the
* number of players. Otherwise, it is equal to the number of players */
context RoundRobinStyle::planRounds(t:Tournament) post:
if (t.players.size.mod(2) = 0) then
result->size = t.players.size - 1
else
result->size = t.players.size
endif
/* Each player plays each other in a RoundRobinStyle tournament.
context RoundRobinStyle::planRounds(t:Tournament) post:
t.players->forAll(p:Player|
p.getMatches(t).players->includesAll(t.players))
```

Computer Science & Information Technology

You might also like to view...

Windows and Orphans can be avoided by altering the margins

Indicate whether the statement is true or false

Computer Science & Information Technology

A form can be saved as a template to allow other users to make changes to the original document

Indicate whether the statement is true or false

Computer Science & Information Technology