Skip to content

Instantly share code, notes, and snippets.

@alex1770
alex1770 / coinbijection.py
Last active March 26, 2024 00:05
Make a bijection between Alice's and Bob's wins in coin-tossing game
# Re https://twitter.com/littmath/status/1770236243911000334
# Coin flipping bijection, based on @NoahJSnyder et al's proof
# Original score: HH scores 1 to Alice and HT scores 1 to Bob
# Adjusted score to Bob: as above except (the last) HT only scores 1/2 to Bob if there isn't a later H.
# Using adjusted scores, the number of Alice wins equals the number of Bob wins.
# The function below produces an explicit, though obscure, "local" bijection between Alice's wins and Bob's wins
# that doesn't involve collecting all of them first.
import sys
@alex1770
alex1770 / gent.cpp
Last active April 28, 2018 11:45
Generate tournaments
// Construct all tournaments of size up to 11
// A. P. Selby / April 2018
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <algorithm>
#include <vector>