Skip to content

Instantly share code, notes, and snippets.

@fred-cook
fred-cook / lets_play_bingo.py
Created October 27, 2025 21:02
A NumPy script for running lots of games of bingo
import numpy as np
import matplotlib.pyplot as plt
def run_bingo_game(max_val: int, cards: np.ndarray) -> np.ndarray:
"""
Run the bingo game until all cards have a BINGO!
In the cards -1 represents a number which has been had
@fred-cook
fred-cook / OTP_bingo.py
Last active October 22, 2025 08:04
A python script to generate OTP bingo cards
import argparse
import random
from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from reportlab.lib.units import mm
def generate_bingo_card(pool: list[int], grid_size: int, add_free: bool = True):
"""Generate a single bingo card using numbers from the shuffled pool."""