承接 mission-gaming/tactician 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mission-gaming/tactician

Composer 安装命令:

composer require mission-gaming/tactician

包简介

A modern PHP library for generating structured tournament schedules with deterministic algorithms like Round Robin, Swiss, and Pool play

README 文档

README

PHP Version License Build Status codecov

Overview

A modern PHP library for generating structured schedules between participants. Ideal for tournaments (round robin, Swiss, pools) but flexible enough for any scenario where entities need to be paired or grouped into events.

Key Features:

  • 🏆 Tournament Formats: Round robin (single & multi-leg), Swiss pairing, single & double elimination, group stages
  • 📊 Results & Standings: Pluggable ranking strategies, league tables, and tiebreakers (wins, Buchholz, Sonneborn–Berger)
  • 🔧 Flexible Constraints: Built-in and custom predicate-based constraint system
  • Schedule Validation: Comprehensive validation prevents incomplete schedules
  • 💾 Serialization: JSON round-tripping for schedules and participants
  • 🎯 Modern PHP: PHP 8.3+ with readonly classes and strict typing
  • 🧪 Test-Driven: Comprehensive test suite with Pest framework
  • 📐 Mathematical Accuracy: Circle method implementation for round-robin
  • 🛡️ Production Ready: PHPStan level 8 compliance with zero errors

Installation

Install via Composer:

composer require mission-gaming/tactician

Requirements:

  • PHP 8.3+
  • No external dependencies in production

Quick Start

<?php

use MissionGaming\Tactician\DTO\Participant;
use MissionGaming\Tactician\Scheduling\RoundRobinScheduler;
use MissionGaming\Tactician\Constraints\ConstraintSet;
use MissionGaming\Tactician\Constraints\SeedProtectionConstraint;

// Create seeded participants
$participants = [
    new Participant('celtic', 'Celtic', 1),        // Top seed
    new Participant('athletic', 'Athletic Bilbao', 2),  // 2nd seed  
    new Participant('livorno', 'AS Livorno', 3),
    new Participant('redstar', 'Red Star FC', 4),
    new Participant('rayo', 'Rayo Vallecano', 5),
    new Participant('clapton', 'Clapton Community FC', 6),
];

// Configure constraints to protect top seeds from early meetings
$constraints = ConstraintSet::create()
    ->add(new SeedProtectionConstraint(2, 0.5))  // Protect top 2 seeds for 50% of tournament
    ->build();

// Generate schedule
$scheduler = new RoundRobinScheduler($constraints);
$schedule = $scheduler->schedule($participants);

// Iterate through matches
foreach ($schedule as $event) {
    $round = $event->getRound();
    echo ($round ? "Round {$round->getNumber()}" : "No Round") . ": ";
    echo "{$event->getParticipants()[0]->getLabel()} vs {$event->getParticipants()[1]->getLabel()}\n";
}

Beyond Round Robin

Results feed standings, and standings drive the incremental engines for Swiss pairing, elimination brackets, and multi-stage tournaments:

use MissionGaming\Tactician\DTO\Result;
use MissionGaming\Tactician\Scheduling\SwissPairingEngine;
use MissionGaming\Tactician\Stage\StageState;

$engine = new SwissPairingEngine(plannedRounds: 5);

// One driver loop covers every results-driven format
$state = StageState::start($participants);
while (!$engine->isComplete($state)) {
    $pairing = $engine->pairNextRound($state);
    $results = playRound($pairing); // application-side
    $state = $state->withRoundPlayed($pairing, $results);
}

// Every format finishes as an outcome you can select from
$outcome = $engine->getOutcome($state);
$table = $outcome->getStandings();

Single and double elimination (SingleEliminationEngine, DoubleEliminationEngine) drive through the same loop, and group stages compose from pools and progression selectors (PoolDistributor, RankRangeSelector, MatchOutcomeSelector) — see the usage guide. Stage state and schedules serialize to JSON (StageState::toJson(), $schedule->toJson()), so platforms persist between rounds instead of re-deriving.

Key Features

  • 🏆 Round Robin Tournaments: Circle method algorithm with balanced home/away roles
  • ♟️ Swiss Pairing: Standings-aware Monrad pairing with repeat avoidance, bye rotation, home/away balancing, and withdrawal handling
  • 🥊 Elimination Brackets: Single and double elimination with positional fold seeding, byes, round labels, fixed or re-seeded paths, one- or two-legged ties, and optional grand-final reset
  • 🏟️ Pools & Progression: Serpentine-seeded pools, per-pool standings, and progression selectors with ahead-of-time composition validation
  • 📊 Results & Standings: Pluggable ranking strategies (win/draw/loss presets included) with wins, Buchholz, and Sonneborn–Berger tiebreakers
  • 🔧 Flexible Constraints: Built-in constraints (rest periods, seed protection, role limits, role balance, metadata rules) plus custom predicates
  • 🏠 Multi-Leg Support: Home/away leagues with mirrored, repeated, or shuffled strategies and first-class byes
  • ✅ Schedule Validation: Mathematical validation prevents incomplete tournaments, with automatic retries over alternative orderings when constraints reject a schedule
  • 💾 Serialization: JSON round-tripping for schedules, events, and participants
  • 🛡️ Production Ready: PHPStan level 8 compliance, comprehensive test coverage
  • ⚡ Memory Efficient: Iterator-based patterns for large tournaments
  • 🎯 Deterministic: Seeded randomization for reproducible results

Documentation

📚 Complete Usage Guide - Comprehensive examples and patterns
🧩 Framework Integration - Wiring Tactician into Symfony and Laravel applications
🏗️ Architecture - Technical design and core components
🛣️ Roadmap - Detailed development phases and use cases
📖 Contributing Guidelines - Development setup and contribution process
📚 Background - Mission Gaming story and problem space details

Sponsorship

Tag1 Consulting

Initial development of this library was sponsored by Tag1 Consulting, the absolute legends.
Tag1 blog & Tag1TeamTalks Podcast

License

This project is licensed under the MIT License - see the LICENSE file for details.

mission-gaming/tactician 适用场景与选型建议

mission-gaming/tactician 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 09 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「fixtures」 「scheduling」 「tournament」 「competition」 「swiss」 「round-robin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mission-gaming/tactician 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mission-gaming/tactician 我们能提供哪些服务?
定制开发 / 二次开发

基于 mission-gaming/tactician 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-12