MIT License

项目介绍

Drarig29/brackets-manager.js 是一个托管在 GitHub 上的开源项目,主要使用 JavaScript 编写,采用 MIT License 许可证,目前获得 329 个 Star、56 次 Fork。

仓库全名
Drarig29/brackets-manager.js
开源许可证
MIT License
Star 数
329
Fork 数
56
未关闭 Issue
5

README 摘要

brackets-manager.js A simple library to manage tournament brackets (round-robin, single elimination, double elimination). It contains all the logic needed to manage tournaments. Features BYE supported: only during creation (for seeding and balancing). Forfeit supported: only during updates. Match supported (locked, waiting, ready, running, completed, archived). Multiple stages per tournament. So you can first have a…

完整内容见 GitHub 原始 README 或本页 。

常见问题

brackets-manager.js 用什么语言开发?

主要使用 JavaScript 编写,采用 MIT License 许可证,目前有 329 个 Star。

brackets-manager.js 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 brackets-manager.js 的源码?

可以直接克隆仓库:git clone https://github.com/Drarig29/brackets-manager.js.git;安装与运行步骤见仓库 README。

brackets-manager.js 最近还在维护吗?

仓库最近一次更新为 5月18日,当前有 5 个未关闭 Issue;Star 数为 329,可作为社区活跃度的参考。

关于

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

README

brackets-manager.js

npm Downloads Package Quality

A simple library to manage tournament brackets (round-robin, single elimination, double elimination).

It contains all the logic needed to manage tournaments.

Features

  • BYE supported: only during creation (for seeding and balancing).
  • Forfeit supported: only during updates.
  • Match supported (locked, waiting, ready, running, completed, archived).
  • Multiple stages per tournament.
    • So you can first have a round-robin stage (which will give you a seeding), then an elimination stage.

Interface

  • This library doesn’t come with a GUI to create and update tournaments.
  • You can use brackets-viewer.js to display the current state of a stage.
  • It is designed to be used with any type of storage (JSON, in-memory, SQL, Redis, and more).
  • Some storage implementations are already available (see the documentation).

Getting Started

For more information, see the documentation.

const { JsonDatabase } = require('brackets-json-db');
const { BracketsManager } = require('brackets-manager');

const storage = new JsonDatabase();
const manager = new BracketsManager(storage);

// Create an elimination stage for tournament `3`.
await manager.create.stage({
  tournamentId: 3,
  name: 'Elimination stage',
  type: 'double_elimination',
  seeding: ['Team 1', 'Team 2', 'Team 3', 'Team 4'],
  settings: { grandFinal: 'double' },
});

await manager.update.match({
  id: 0, // First match of winner bracket (round 1)
  opponent1: { score: 16, result: 'win' },
  opponent2: { score: 12 },
});

The manager emits events when storage mutation operations succeed:

manager.on('entity.changed', event => {
  // Any successful insert, update or delete operation.
});

Rendered with the viewer:

image

As you can see, the manager is composed of submodules, which themselves have methods:

You can navigate the API documentation here: BracketsManager class documentation

All the helpers defined by the library are available here:

const { helpers } = require('brackets-manager');

Credits

This library has been created to be used by the Nantarena.

It has been inspired by:

评论

暂无评论