Open rooms cost the server memory and a game clock each, so it can keep only so many open at once: its capacity, set when it starts. Nothing ever closes a room today, so after enough games every new code is a room the server cannot afford. Players now tell the server when they leave.
The server keeps every room it ever opened. With a limit and no way to close rooms, it would turn away new games forever; without the limit, it grows until it falls over.
Reproduce
A server with capacity 1: alice joins chess ABCD, then bob tries to start checkers WXYZ. bob should be rejected (the server is full) while carol can still join chess ABCD. Today bob gets a second room, and the server keeps 2 open.
Acceptance criteria
- A join that would open a new room when the server already keeps its capacity of rooms is rejected, without making a room or changing an open one; joining an open room still works when the server is full.
- leave takes one player out of a room and returns how many are left; when the last player leaves, the room closes and its slot is free again.
- After a room closes, a join with its code makes a new room from move 0; a player who left still holds the old room, which keeps its moves.
- Leaving a room that is not open is rejected; everything MULTITON-101 asked still holds.
Notes
- Cases print each join (game/CODE #number moves=n, or rejected), each leave (n left, or rejected), what a player sees, whether two players share a room, and how many rooms a server keeps open.
- The checker gives each server its own capacity, from 1 to 3. Keep the names and signatures; each case makes its own servers.
- Each join is one player: two joins with one code are two players in one room.