Skip to content

[WIP] Add chess championship orchestration framework - #2

Merged
bylinina merged 1 commit into
mainfrom
copilot/add-championship-module
Mar 6, 2026
Merged

[WIP] Add chess championship orchestration framework#2
bylinina merged 1 commit into
mainfrom
copilot/add-championship-module

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor
  • Create chess_tournament/championship/__init__.py with exports
  • Create chess_tournament/championship/config.py with ChampionshipConfig and setup_logging
  • Create chess_tournament/championship/validator.py with SubmissionValidator
  • Create chess_tournament/championship/runner.py with TournamentRunner
  • Create chess_tournament/championship/leaderboard.py with LeaderboardGenerator
  • Create chess_tournament/championship/orchestrator.py with ChessChampionship
Original prompt

Add chess championship orchestration framework

Overview

Add a new championship module to the chess_exam package that provides clean, modular tools for running multi-stage chess tournaments with student submissions.

Features

  • ChampionshipConfig: Centralized configuration management with Google Colab support
  • SubmissionValidator: Validate student submissions using the existing validate_player function
  • TournamentRunner: Execute Swiss and round-robin tournament stages
  • LeaderboardGenerator: Generate readable Markdown leaderboards with tie-breaking rules
  • ChessChampionship: Main orchestrator that coordinates all stages (Qualifiers → Semifinals → Finals)

Implementation Details

New Module Structure

chess_exam/chess_tournament/championship/
├── __init__.py          (exports all public classes)
├── config.py            (ChampionshipConfig, setup_logging)
├── validator.py         (SubmissionValidator)
├── runner.py            (TournamentRunner)
├── leaderboard.py       (LeaderboardGenerator)
└── orchestrator.py      (ChessChampionship - main class)

Key Features

  • Modular design: Each component has a single responsibility
  • Google Colab integration: Auto-detects mounted Google Drive for output
  • Resumable tournaments: All state saved to CSV files
  • Clean logging: Both file and console output with timestamps
  • Tournament stages:
    • Qualifiers: Swiss format with groups
    • Semifinals: Swiss format with top qualifiers
    • Finals: Can use round-robin for final leaderboard
  • Tie-breaking: Points → Buchholz → Fallbacks (integrates with existing swiss_tournament function)
  • Player management: Uses existing instantiate_participant and destroy_instance from chess_exam

Integration Points

  • Uses validate_player() from chess_tournament.validate
  • Uses swiss_tournament() and round_robin_tournament() from chess_tournament.tournament
  • Uses instantiate_participant() and destroy_instance() from chess_tournament.tournament
  • Depends on pandas, numpy for data handling

Usage Example

from chess_tournament import RandomPlayer, EnginePlayer
from championship import ChessChampionship, ChampionshipConfig
import pandas as pd

# Define baseline players
baselines = {
    "random": {"name": "Random", "factory": lambda: RandomPlayer("Random")},
    "stockfish": {"name": "Stockfish", "factory": lambda: EnginePlayer("Stockfish")}
}

# Load submissions
submissions_df = pd.read_csv("submissions.csv")

# Run championship
config = ChampionshipConfig()
championship = ChessChampionship(config, baselines)
results = championship.run(submissions_df)

Files to Add

  1. chess_tournament/championship/__init__.py - Package init with exports
  2. chess_tournament/championship/config.py - Configuration classes
  3. chess_tournament/championship/validator.py - Submission validation
  4. chess_tournament/championship/runner.py - Tournament execution
  5. chess_tournament/championship/leaderboard.py - Output generation
  6. chess_tournament/championship/orchestrator.py - Main coordinator

Testing

  • Integrates with existing tournament functions (no modifications to existing code)
  • Uses existing validate_player for validation
  • Compatible with all existing Player classes
  • Works on both local and Google Colab environments

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@bylinina
bylinina marked this pull request as ready for review March 6, 2026 14:27
@bylinina
bylinina merged commit 94f4910 into main Mar 6, 2026
1 check failed
Copilot stopped work on behalf of bylinina due to an error March 6, 2026 14:28
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.

2 participants