Code Monkey home page Code Monkey logo

tourney-bot's Introduction

TourneyBot

This project is for the web application used to run the Houston Indoor Ultimate tournament. An installation of this project can be seen at houstonindoor.com

The Houston Indoor tournament uses a Swiss system with some unique criteria. In particular, since there is typically only one field available for an indoor tournament, field time needs to be maximized with a game always playing. The tournament is scheduled with exactly one minute of down time between games; just enough time for teams to switch on and off the field.

This is a challenge for a Swiss system where you do not know the next round's matchups until all the games in a round are played. This application provides tools for dealing with this situation and ensuring that a "forward schedule" is always available.

In addition, it provides a mobile-friendly website where players can see the current schedule, their team results, and general tournament information. The public-facing website receives near-realtime updates of all tournament information, so players do not need to refresh the page in order to see the latest information. See the architecture section for more information about this feature.

Screenshots

Here are some screenshots of TourneyBot.

Development Setup

Install Leiningen and Node.js

# install node_modules (one-time)
npm install

# you may wish the run the following commands in separate console tabs / windows

# build CLJS files
lein clean && lein cljsbuild auto

# compile LESS into CSS
grunt watch

# run a local web server out of public/ on port 9955
node server.js 9955

# produce a build in the 00-publish/ folder
grunt build

Installation

The steps for starting a new tournament are roughly as follows:

  1. Make sure the CLJS-generated files exist by running lein clean && lein cljsbuild once
  2. Create a build in the 00-publish folder with the command grunt build
  3. Copy the 00-publish/ folder to a public web server that has PHP installed.
  4. Edit the info.md file as appropriate for your tournament.
  5. Edit the tournament.json file as appropriate for your tournament.
  6. Set a password in api.php

Architecture

TourneyBot can be thought of as two separate applications that are designed to work together: the client side and the admin side.

The entire tournament state is held in the tournament.json file. The client side polls for that file every few seconds and updates the UI accordingly. The admin side contains functions that modify tournament.json and save it to the server. You could, for example, run an entire tournament by editing the tournament.json file directly.

The Info page is held in info.md and requested on initial load, then again every 5 minutes. It is expected that the info page will not change very much while the tournament is happening.

The role of PHP in TourneyBot is minimal and could be swapped out for something else easily. It was just the most convenient hosting option for me for the 2016 tournament.

Future Development

TourneyBot was primarily created for the 2016 Houston Indoor Ultimate Tournament and has a lot of code to deal with the unique constraints of that tournament.

It would be great to extend this project and make it more flexible for other Ultimate tournament formats. Please reach out or post in the issues if you are interested in helping with that.

License

ISC License

tourney-bot's People

Contributors

oakmac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tourney-bot's Issues

System to help run the Houston Indoor Ultimate Tournament

The Houston Ultimate Indoor Tournament has some unique requirements for an Ultimate tournament:

  • Games are determined by a Swiss system, which means you don't know the next round's matchups until the current round is finished.
  • There is only one field, so it needs to have a game playing on it at all times (ie: no down-time between matches).

The purpose of this project is to build a system that can manage these unique requirements.

Automatic "in progress" games

Once the tournament has begun, there should always be an "in progress" game.

In general, flagging the current "in progress" game's scores as final should start the next game as "in progress".

Show "these teams already played"

When you select two teams to play that have already played each other in prior swiss rounds.

It can just show up on the game row where you have picked the two teams.

Admin side dangerous race condition

This is a tricky one.

The way things work currently, the Admin side pushes a full state update every N seconds and never requests an update from the server (ie: the admin side only pushes, it never pulls). This makes it impossible for more than one person to be using the admin side at a time; they will constantly overwriting each other's edits with every update.

This worked ok for the 2016 tournament, but we need a better solution here.

One option: control the admin side using sockets and just make everything real-time.

Another option: use versioning on the state updates to make sure all clients are on the latest version.

better matchups algorithm and automatic game population

It shouldn't be too hard to improve the matchups algorithm and have it automatically populate the next swiss round:

  1. Sort teams by score.
  2. Start with the top team, work down the teams until we find the closest team in score that has not already played the top team. Match them together and remove both from the list.
  3. Repeat Step 2 with the remaining teams until there are no teams left.

Ability to flip teamA and teamB

It would be nice to have a "flip" button for teamA and teamB on the edit game modal so it can match which side the actual teams are on.

ensure tournament structure values

It would be nice to write some simple functions that ensure a valid tournament state and have them run on every state change.

Examples:

  • make sure that any team-ids referenced in games exist
  • make sure every game state is valid (a game with scores cannot be "scheduled", for example)
  • make sure that game scores are integers
  • etc

time inputs on the admin side - sorting problem

When using the admin side and updating time inputs, you can inadvertently re-sort the game list as you're inputting values due to the way rum / react is constantly updating the UI as you type.

Probably need to make the time inputs transient state components and only update the state on an onBlur event from them. This also gives us a chance to make sure the time is formatted correctly.

Another option might be to do time input on a separate screen from the games input. Would make the games input pages less busy.

better display for pending games

When teamA is set, but teamB is not set, the clientside has a bug showing "TeamA vs"

In general, we need a better display for pending games.

warning when connection is lost

This was a problem for the 2016 tournament. Network connectivity at sports facilities is less-than-optimal. Several times the laptop being used for admin updates had lost connectivity and the only way we were able to figure that out is because the client side was not receiving the score updates.

Need a way to communicate to the admin when they have lost their network connection. I think re-vamping the admin side using sockets would help here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.