# How Our Swiss-System Algorithm Works

Our system is based on a modified version of the algorithm originally developed for the **Windmill tournament**. It combines a **Swiss draw structure** with a custom **power ranking model**. We've adapted it to be more flexible, allowing for custom settings for both local and international tournaments.

Want to dive deeper into the math behind power rankings? Check out: [Power Rankings in Ultimate – Leaguevine](https://www.leaguevine.com/blog/134/power-rankings-in-ultimate/)

## What’s the Goal?

Our goal is to create the most exciting and balanced games possible. We’re not fans of blowouts — we want those tight matches that go down to the wire, where both teams give it everything.

To make that happen, our system pairs teams with others of **similar skill**, so every game feels fair and competitive.

## The Two-Part Algorithm

The algorithm runs in two main steps:

1. **Estimate the strength of each team**
2. **Pair teams for the next round**

**Step 1: Calculating Team Strength**

This is where the real math kicks in. After every round, we analyze the scores from all games and calculate how strong each team is — based not just on wins and losses, but **on the score difference** and **who they played against**.

For example:

* If Team A beats Team B by 5 points, Team A’s rating goes up by +2.5, and Team B’s goes down by -2.5.
* If Team B later beats Team C by 5, Team C gets -2.5, and so on.

This process is called **power rating** — and it recalculates after every round. So, your strength doesn’t just depend on your last match, but also on how strong your past opponents turn out to be.

The result? A live, updated strength ranking of all teams.

**Step 2: Matchmaking for the Next Round**

Now we use those ratings to decide who plays who next.

We build a table that shows every possible matchup, and assign each one a **penalty score** — which represents how “unfair” or unbalanced the game would be. The bigger the skill gap, the bigger the penalty.

Then the algorithm picks the set of matchups that gives us the **lowest total penalty** across the whole round.

```html
        A     B     C     D
    A   X    10    30    20
    B  10     X    20    40
    C  30    20     X    10
    D  20    40    10     X
```

In this case, the algorithm would pair:

* A vs B
* C vs D

...with a total penalty of just 20 — the best possible pairing.

## How Penalties Are Calculated

In the current version, the penalty between two teams is based on the **difference in power rating**:

* If Team A has 3.5 points and Team B has 1.0, the penalty is **2.5 points**.

There are also **special rules** built in to fine-tune the matchmaking:

* **100,000 penalty points** for **rematches** — effectively preventing teams from playing each other more than once.
* **0.1 penalty point** for matchups between teams from the **same country** — to encourage international diversity, especially in large tournaments.

**These values are fully customizable** by tournament organizers:

* For local event, you might assign higher penalties to matchups between teams from the **same city.**
* In more regional setups, you can lower these values if local rematches are acceptable or desired.

Thanks to this system, every game feels meaningful, competitive, and fun — for players, organizers, and spectators alike.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ultie.org/for-players/how-our-swiss-system-algorithm-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
