Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

Enables running two independent tournaments simultaneously in Room 1 and Room 2. Each room maintains separate state for players, rounds, and scores.

Implementation

Backend

  • Replaced singleton tournament with Dictionary<int, Tournament> keyed by room ID
  • Added RoomId property to Player, Tournament, TournamentStatusResponse, TournamentHistory
  • Updated service interface and all controllers to accept optional roomId parameter (defaults to 1)
  • Player IDs now scoped per room (both rooms can have Player ID 1)

Frontend

  • Added room selector toggle buttons to dashboard
  • All forms and navigation include room parameter
  • Room number displayed in headers and status

Python Client

  • RPSGameClient constructor accepts room_id parameter
  • Game agent and Flask app updated with room selection UI

Example Usage

// Register players to different rooms
var room1Player = _tournamentService.RegisterPlayer("Alice", roomId: 1);
var room2Player = _tournamentService.RegisterPlayer("Bob", roomId: 2);

// Each room maintains independent state
var room1Tournament = _tournamentService.GetTournament(roomId: 1);
var room2Tournament = _tournamentService.GetTournament(roomId: 2);
# Python client usage
client = RPSGameClient(room_id=1)
response = client.register_player("Player1")

Screenshots

Room selector and independent state:

Room 1 with TestPlayer1

Room 2 with TestPlayer2

Notes

  • Room IDs validated to be 1 or 2 at API layer
  • Backward compatible: existing code without room parameter uses Room 1
  • Thread-safe via existing lock mechanism in TournamentService
Original prompt

This section details on the original issue you should resolve

<issue_title>add support for 2 tournaments running at the same time</issue_title>
<issue_description>
modify the code inside apps-rps folder to add new support for 2 tournaments running at the same time

1- add room concept when starting a tournament. you can select room 1 or room 2
2- once the players has registered with room 1 or room 2, the each room will run the process separately
3- when join the game, the player client and agents need to selected room 1 or room 2 as well

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: qkfang <138417504+qkfang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for two tournaments running concurrently Add multi-room support for concurrent tournaments Nov 9, 2025
Copilot AI requested a review from qkfang November 9, 2025 22:38
Copilot finished work on behalf of qkfang November 9, 2025 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support for 2 tournaments running at the same time

2 participants