Instructions

How to Participate

1. Generate Bracket Files

Bracket Generation:

File Format:

Code Example: Generating Brackets and Writing to Files

Below is an example of how to generate brackets, pack them into the specified binary format, and write them to files.


import os

def pack_bracket(bits):
    assert len(bits) == 67, "Bracket must have exactly 67 bits"
    bytes_out = bytearray(9)
    bit_index = 0

    for byte_index in range(9):
        byte = 0
        for bit_position in range(8):
            if bit_index < 67:
                bit = bits[bit_index]
                byte = (byte << 1) | bit
                bit_index += 1
            else:
                byte = (byte << 1)  # Pad with zero for unused bits
        bytes_out[byte_index] = byte

    return bytes_out

# Example brackets
# Bracket 1: All favorites win
bracket_all_favorites = [1] * 67

# Bracket 2: Some upsets
# Let's assume upsets in bits 4 (first round game), 20 (second round game), and 66 (championship game)
bracket_some_upsets = [1] * 67
bracket_some_upsets[4] = 0    # Lower seed wins in game corresponding to bit 4
bracket_some_upsets[20] = 0   # Lower seed wins in game corresponding to bit 20
bracket_some_upsets[66] = 0   # Team from latter region wins championship game

def write_brackets_to_file(bracket_list, filename):
    with open(filename, 'wb') as file:
        for bits in bracket_list:
            packed_bracket = pack_bracket(bits)
            file.write(packed_bracket)

# Write example brackets to two files
bracket_list_file1 = [bracket_all_favorites, bracket_some_upsets]
bracket_list_file2 = [bracket_some_upsets, bracket_all_favorites]

write_brackets_to_file(bracket_list_file1, 'brackets_file1.bin')
write_brackets_to_file(bracket_list_file2, 'brackets_file2.bin')

2. Compute Hashes of Your Files

Use SHA-256 to compute the hash of each bracket file. The hashes will be submitted before the tournament.

Code Example: Computing Hashes and Generating the Hash Submission File

import hashlib

def compute_file_hash(filename):
    sha256_hash = hashlib.sha256()
    with open(filename, 'rb') as file:
        for block in iter(lambda: file.read(4096), b''):
            sha256_hash.update(block)
    return sha256_hash.hexdigest()

def generate_hashes_for_files(file_list, output_hash_file):
    with open(output_hash_file, 'w') as hash_file:
        for filename in file_list:
            file_hash = compute_file_hash(filename)
            hash_file.write(file_hash + '\n')

# Generate hashes for the two example files
file_list = ['brackets_file1.bin', 'brackets_file2.bin']
generate_hashes_for_files(file_list, 'hashes.txt')

3. Submit Hashes Before the Tournament

Hash Submission File:

Upload Hashes:

4. Post-Tournament Verification

If you believe your brackets include the perfect bracket:

  1. Make Your Winning Bracket File Available Online:
    • Upload the bracket file that contains the perfect bracket to a publicly accessible URL.
  2. Submit the URL and Hash via the Competition Website:
    • Log in to your account on the competition website.
    • Navigate to the Verify Winning Bracket page.
    • Enter the URL where your bracket file is hosted.
    • Enter the SHA-256 hash of your bracket file.
Hosting and Submitting Your Winning Bracket File

Suppose your bracket file is brackets_file1.bin, and it contains the perfect bracket.

  1. Compute the Hash of the Winning Bracket File:
  2. Host the File Online:
    • Upload brackets_file1.bin to a web server or a file hosting service that provides a direct download link.
  3. Submit via the Website:
    • Go to the Verify Winning Bracket page on the competition website.
    • Enter the URL and the hash of your bracket file.
    • Submit the form.

The competition organizers will then:


File Format Details

Bracket Representation

Bit-to-Game Mapping

General Rules
Detailed Bit Mapping
Bits 4–35: First Round (Round of 64)

There are 32 games in the First Round, 8 games per region.

Bit Value for First Round Games (Bits 4–35):

Bits 36–51: Second Round (Round of 32)

There are 16 games in the Second Round, 4 games per region.

Bit Value for Second Round Games (Bits 36–51):

Bits 52–59: Regional Semifinals (Sweet Sixteen)

There are 8 games in the Sweet Sixteen, 2 games per region.

Bit Value for Sweet Sixteen Games (Bits 52–59):

Bits 60–63: Regional Finals (Elite Eight)

There are 4 games in the Elite Eight, 1 game per region.

Bit Value for Elite Eight Games (Bits 60–63):

Bits 64–65: Final Four Games
Bit 66: Championship Game

Matchup: Winner of Semifinal Game 1 vs Winner of Semifinal Game 2

Bit Value:

Bits 67–71: Unused (set to 0)

Submission Guidelines

Before the Tournament

  1. Prepare Your Bracket Files:
    • Generate your bracket files according to the specified format.
    • Ensure each file contains no more than 100 million brackets.
  2. Compute SHA-256 Hashes:
    • Calculate the SHA-256 hash for each bracket file using the provided code or your own implementation.
    • Record the hashes in a text file (hashes.txt), one hash per line.
  3. Submit Hashes:
    • Upload your hashes.txt file via the competition website.
    • Ensure the hashes are in the order you intend (affects tie-breakers).

After the Tournament

  1. Make Your Winning Bracket File Available Online:
    • Upload the bracket file containing the perfect bracket to a publicly accessible URL (e.g., your website, GitHub, a file-sharing service).
    • Ensure that the file is accessible without authentication and can be downloaded directly.
  2. Submit the URL and Hash via the Competition Website:
    • Log in to your account on the competition website.
    • Navigate to the Verify Winning Bracket page.
    • Fill out the form with:
      • The URL of your bracket file.
      • The SHA-256 hash of your bracket file.
    • Submit the form.
  3. Verification Process:
    • The competition organizers will:
      • Verify that the provided hash exists in your submitted hashes.txt file.
      • Download your bracket file from the provided URL.
      • Verify that the hash matches the provided hash.
      • Check if the perfect bracket is present in your file.
      • Determine the winner based on the tie-breaker rules.