I spent all of today at a Super Smash Bros. tournament, and I started thinking about some of the terminology we use when describing sets. These are the three kinds of sets that I see played at tournaments:
- Best of 3 (Bo3)
- Three games are played. The winner of the set is the player who won the majority of the games.
- If a single player wins two games of the set, they are immediately declared the winner, because it would be impossible for the opponent to catch up.
- Best of 5 (Bo5)
- Five games are played. The winner of the set is the player who won the majority of the games.
- If a single player wins three games of the set, they are immediately declared the winner, because it would be impossible for the opponent to catch up.
- First to 5 (Ft5)
- Okay, I cheated a bit with my wording earlier. This kind of set isn't part of a tournament, but you'll often see them happening in the venue. This is traditionally the kind of set you'll play if you've challenged another player and money is on the line.
- It's as simple as it sounds: The players repeatedly play games until one of them has won five, and that player is declared the winner.
Obviously, Bo3 and Bo5 are very similar, differing only in the number of games played. But Ft5 is clearly different... right? Not really! No matter how a Bo3 set goes down, the winner will have won exactly two games. The winner of a Bo5 set will have won exactly 3 games. Why not call them Ft2, or Ft3? The same logic, applied in reverse, will show that Ft5 is exactly the same as Bo9.
The objective of this challenge is to determine the synonym of a set format.
Specification
Your program or function will take a single string from input. The first two characters will be Bo
or Ft
, and they will be followed by a number. The program/function will output a string with the opposite prefix and a number such that the input and output strings mean the same thing.
Any string beginning with Bo
will end in an odd number.
You may assume that the number in the input string will never be greater than 200. You may also assume that you will never receive input for which the correct output would include a number greater than 200. Likewise, the input and correct output numbers will always be greater than 0.
Examples
Bo3 -> Ft2
Ft2 -> Bo3
Bo5 -> Ft3
Ft3 -> Bo5
Bo9 -> Ft5
Ft5 -> Bo9
Bo51 -> Ft26
Ft26 -> Bo51
Bo199 -> Ft100
Ft100 -> Bo199