Logical Interactions 2
Player API
|
start: Boolean -> Map |
// is this player participating in the tournament that is about to start up |
|
end : Boolean -> Void |
// did this player win the tournament? |
Sequences
The interaction between players and the manager is governed by the following interaction diagrams.
Starting a Tournament
|
manager <---------------------- player (p_1) . . . player (p_n) |
| | | % for n <= MAX_PLAYERS |
| | | |
| | | |
| | | |
| start(Boolean) | | % true means the tournament |
| -----------------------------> | | % is about to start |
| Map | | |
| <============================ | | % player submits a map |
. . . % in response |
. . . |
. . . |
| start(Boolean) | | |
| -----------------------------------------------> | |
| | | |
| Map | | |
| <=============================================== | |
Running a Tournament
|
manager player (p_1) . . . player (p_n) |
| | | |
| new(map, players[]) | | |
| -----------------> referee | | |
| | | | |
. . . . |
. . . . % play a game |
. . . . % (see below) |
. . . . |
. . . . |
| | | | % the ranking |
| ranking, players[] | | | % & cheaters |
| <=================== | | | |
. ___ . . |
. . . |
. . . % as long as |
. . . % one game can |
. . . % be played |
. . . |
| | | |
| new(players[]) | | |
| -----------------> referee | | |
| | | | |
. . . . |
. . . . % play last game |
. . . . |
. . . . |
| | | | |
| | | | % the ranking |
| ranking, players[] | | | % the "cheaters" |
| <=================== | | | |
. ___ . . |
| | | |
| | | |
Terminating a Tournament
|
manager player (p_1) . . . player (p_n) |
| | | |
| | | |
| end(Boolean) | | |
| -----------------------------> | | % true means "winner" |
| | | % false means "loser" |
. . . |
. . . |
. . . |
. . . |
| end(Boolean) | | |
| -----------------------------------------------> | |
| | | |
| | | |
Convention The % parts on the right are interpretive comments. ~~ A missing return arrow means that method must successfully return void.
raises an exception (a safety bug)
takes too long for a computation (a DoS bug).
These terminations are not specified in the sequence diagram.