Last Updated on
No matter your metaphor, distillation is all about getting to the good stuff. Whether it’s whiskey getting triple distilled, a viral tweet link getting shortened, or the slow march of March Madness through the Round of 32, to the Sweet 16, to the Elite 8 and beyond, it’s all about something big somehow getting bigger by becoming smaller.
Now, we can’t help you with the whiskey part, but we DO have a little something for you in the way of some Twitter and March Madness magic. You may recall a post from March 15th in which we introduced something called #ByteBracket. This little bit of algorithmic magic rather took on a life of its own, and a whole lot of basketball lovers ended up vying for bragging rights with their tweetable brackets.
You’ve spent days filling out the perfect March Madness bracket. You’ve painstakingly deliberated over every one of the 63 games in the tournament and you’re certain that you’ve correctly predicted every upset.
Now you want to share your bracket. You’d love to tweet it to your followers, but how could you ever express the intricacies of your bracket in 140 characters?
It just can’t be done!
Or can it?
ByteBracket is a unique, compact representation of a March madness bracket. It’s a sequence of 16 letters and numbers which can completely specify any bracket. For example, it’s entirely possible that the winning bracket this year will be A7BD83321FF240D2. But for this to work, we’ll need a set of rules for converting such a sequence into an actual bracket of teams. This calls for a protocol!
How ByteBracket works
To understand how ByteBracket works, let’s first imagine a miniature version of the NCAA basketball tournament.
In this 8 team version there are 7 total games and the first round has 4 games. Now, let’s say I think Teams A, D, F, and G will win their first games. Now my bracket would look like this:
Now, let’s think about what actually happened in that stage. All I really did was make 4 binary decisions: for each game, I simply had to decide whether I thought the top team (the team above the line) or the bottom team would win. Now, let’s say I made the following the rule:
- If the team above the line wins, call that a 1
- If the team below the line wins, call that a 0
Well, in games 1 through 4, I chose above, below, below, above, which I could represent as 1001
If I then predicted team A would win G5 and team F would win G6, I would add a 1 and a 1. So now my bracket would be 100111.
Now I need a rule for who goes on top in G7. Let’s say the winning team from the left always goes on top. Now my bracket looks like this:
I think team F is going to win it all. F is on the bottom, so I’m going to add another 0 to my sequence: 1001110.
Now, if there were only one tournament happening at a time, this would be enough information to fully specify my bracket. But there are two: the men’s and the women’s leagues. No problem, I’ll just make the following rule:
- If your bracket is for the men’s league, the last character in your bracket should be a 1
- If your bracket is for the women’s league, the last character in your bracket should be a 0
Let’s say this were my bracket for the men’s tournament. I add another 1 and now I have my full bracket 10011101.
This is great! We’ve captured all of our bracket-making decisions into a sequence of 8 1’s and 0’s. I could give this sequence to anyone who knew the rules I used and they would be able to perfectly reproduce my bracket.
Now this is pretty good, but it’s not great. 8 characters isn’t bad for this mini-tournament, but for the real, 64-team tournament this would require a sequence of 64 1’s and 0’s.
That’s too long. Let’s shorten this sequence of 1’s and 0’s.
To shorten our sequence 10011101 it’s helpful to think in terms of binary. You’re probably used to the base 10 number system where you use the digits 0-9 to represent any number you’d like. Binary is similar, except it only uses 0 and 1. Here’s a table for converting the numbers 0-15 from base ten to binary:
So a sequence of 4 1’s or 0’s is really just a fancy way of writing a number between 0 and 15. This will be useful! After all my bracket, 10011101, is really just two sets of four numbers: 1001 and 1101
Shortening ByteBracket with Hex
Hexadecimal (commonly known as Hex) is a base 16 number system. The numbers 0 – 9 are all represented as normal, but the numbers 10-15 are represented with the letters A through F.
This means that my bracket is actually just two hex numbers: 1001 is 9 and 1101 is D. My complicated selection of winners and losers can be fully represented as 9D.
The Full Tournament
The real March Madness tournament has 64 teams (and two leagues, one men and one women). This tournament would require a sequence of 64 1s and 0s. We’ve already seen how a sequence of four 1s and 0s can be represented by a single hexadecimal character, so this means the full tournament will require 16 characters (64 / 4). Now you can unambiguously tweet your incredible predictions and still have plenty of characters left to gloat!
The ByteBracket Protocol Summary
A ByteBracket string is generated as follows:
- First, assign each game a number between 1-63 using the following rules:
- Earlier rounds are lower numbers (so the numbers 1-32 are for round 1, 33-48 for round 2, etc…)
- Within a round, assign numbers from top to bottom and then from left to right. (so the top left quadrant of the first round would have games 1-8, the bottom left would be 9-16, top left is 17-24 and bottom right is 25-32)
- Go through each of the 63 games in sequential order and assign a 1 or 0 to that game. If you think the team on the top will win, assign a value of 1. If you think the team on the bottom will win, assign a value of 0.
- You should now have a sequence of 63 1’s and 0’s. If you are filling out a men’s bracket, make the 64th character a 1. If it’s a women’s bracket, the 64th character is a zero.
- Now break your 64 character sequence into 16 chunks of 4.
- Convert each chunk into a hexadecimal character. You now have your ByteBracket!
Whiskey, Twitter, and Basketball, anyone?