# Rankings

Rankings at NHRL are calculated by a custom formula. Your ranking is based on your stats from the current season and the previous season.

## Formula

The basic idea is simple: looking at fights from this season and last season, each bot gets 1 point for a win, and loses 1 point for a loss. So if you take the number of wins a bot has, and subtract the number of losses it has, you get the base point value for rankings.

*Example:* A bot is 10-5 at NHRL. It has 5 points.

We then apply 3 modifiers: a **rookie penalty**, an **upset penalty/bonus**, and a **finals bonus**.

### Rookie penalty

Each bot has a penalty assigned to it, equal to **(number of fights) - (minimum fights)**, with a minimum value of 0. The rookie penalty ensures that new bots begin near the bottom of the rankings table, instead of the middle.

The **minimum fights** value is different depending on which rankings we are looking at. For 3lb all-time rankings, it is 10; for 3lb single-year rankings, it is 8; for all other rankings, it is 5. This number may get tweaked in the future, if the 12lb and 30lb weight classes fight more often.

This means that a 12lb bot that has never fought at NHRL will have a total point value of -5, and 12lb bots with 5 or more NHRL fights have a rookie penalty of 0.

*Example:* A 12lb bot is 2-1 at NHRL. The minimum fights value for 12lb bots is -5. So the bot has -1 points; 1 point for its record, minus 2 rookie points (3 total fights - minimum fights of 5).

### Upset penalty/bonus

For each fight, we compare the bots' winning percentages. If the bot with a lower winning percentage defeats a bot with a higher winning percentage, then the winning bot gets a bonus and the losing bot gets a penalty. The value of this bonus/penalty is the same for both bots: the difference between the two winning percentages, multiplied by 2.5.

For this calculation only, we add 5 virtual wins and 5 virtual losses to a bot's winning percentage. This means that if a bot with an 0-1 record defeats a bot with a 3-0 record, we don't apply as large a modifier as if a bot with an 0-10 record beat a bot with a 30-0 record.

*Example:* A bot with a 5-15 record beats a bot with a 15-5 record. For this calculation, we add 5 virtual wins and losses to each bot's record, which makes their records 10-20 (.333 win percentage) and 20-10 (.667 win percentage). The upset penalty/bonus is 0.667 - 0.333 = 0.334 * 2.5 = 0.84 points. This means the winner of the fight gets 1.84 points, and the loser of the fight loses 1.84 points.

*Example:* A bot with an 0-1 record defeats a bot with a 3-0 record. With virtual wins and losses, their records become 5-6 and 8-5, for win percentages of .455 and .615, respectively. The upset penalty is 0.615 - 0.455 = 0.16 * 2.5 = 0.4 points. So the winning bot gets 1.4 points, and the losing bot loses 1.4 points.

### Finals bonus

If a bot reaches the Semifinals of its bracket, it receives 0.5 bonus points, regardless of whether it wins or loses the match, and regardless of whether or not the match is forfeited (as forfeits don't normally count for wins or losses, and otherwise result in a fight being worth 0 points).

If a bot reaches the Final, it receives another 0.5 bonus points, in a similar fashion as above.

This bonus was 0.25 points before the 2023 season.

*Example:* A bot reaches the Semifinals, and beats a bot with a lower win percentage. The fight is worth 1.5 points for the winner, and -0.5 points to the loser.

*Example 2:* Two bots from the same builder reach the Final. As per the rules, the builder opts to not fight their own bots. The fight is technically a forfeit. Both bots receive 0.5 points for reaching the Final, and 0 points for the fight itself, for a total of 0.5 points.