nowfound

Commerce · February 28, 2025

BG

Betting game puzzle (Hamming neighbor sum in linear time)

In Spain, there's a betting game called La Quiniela: https://es.wikipedia.org/wiki/La_Quiniela_(Espa%C3%B1a) Players predict the outcome of 14 football matches (home win, draw, away win). You win money if you get at least 10 correct, and the prize amount depends on the number of winners. Since all bets are public, the number of winners and the corresponding payouts can be estimated for each of the 3^14 possible outcomes. We can also estimate their probabilities using bookmaker odds, allowing us to compute the expected value for each prediction. As a side project, I wanted…

Alternativestop 24% of February 2025

In plain words

This tool analyzes Spain's La Quiniela betting game, where players predict outcomes of 14 football matches to win prizes. It calculates expected value for each possible prediction by estimating winner counts and payouts from public bet data, combined with bookmaker odds. The software addresses a computational challenge: efficiently summing values across thousands of similar predictions (Hamming neighbors) to enable rapid evaluation of betting strategies.

written from the facts on this page · September 2026

From the sources

In the maker’s words, at launch

In Spain, there's a betting game called La Quiniela: https://es.wikipedia.org/wiki/La_Quiniela_(Espa%C3%B1a) Players predict the outcome of 14 football matches (home win, draw, away win). You win money if you get at least 10 correct, and the prize amount depends on the number of winners. Since all bets are public, the number of winners and the corresponding payouts can be estimated for each of the 3^14 possible outcomes. We can also estimate their probabilities using bookmaker odds, allowing us to compute the expected value for each prediction. As a side project, I wanted to analyze this, but ran into a computational bottleneck: to evaluate a prediction, I had to sum the values of all its Hamming neighbors up to distance 4. That’s nearly 20,000 neighbors per prediction (1+28+364+2912+16016=19321): S_naive = sum from k=0 to r of [(d! / ((d-k)! * k!)) * (q-1)^k] (d=14, q=3, r=4) This took days to run in my first implementation. Optimizing and doing it with matrices brought it down to 20 minutes—still too slow (im running it in GAS with 6 minutes limit). For a while, I used a heuristic: start from a random prediction, check its 28 nearest neighbors, move to the highest-value one, and repeat until no improvement is possible within distance 3. It worked surprisingly well. But I kept thinking about how to solve the problem properly. Eventually, I realized that partial sums could be accumulated efficiently by exploiting overlaps: if two predictions A and B share neighbors, their shared neighbors can be computed once and reused. This is achieved through a basic transformation that I implemented using reshape, roll, and flatten (it is probably not the most efficient implementation but it is the clearest), which realigns the matrix by applying an offset in dimension i. This transformation has two key properties that enable reducing the number of summations from 19,321 to just 101: - T(T(space, d1), d2) = T(T(space, d2), d1) - T(space1, d) + T(space2, d) = T(space1+space2, d) Number of sums would be the result of this expression: S_PSA = 1 + (d - (r-1)/2) * r * (q-1) I've generalized the algorithm for any number of dimensions, elements per dimension, and summation radius. The implementation is in pure NumPy. I have uploaded the code to colab, github and an explanation in my blog. Apparently, this falls under Hamming neighbor summation, but I haven't found similar approaches elsewhere (maybe I'm searching poorly). If you know or you've worked on something similar, I'd love to hear your thoughts! colab: https://colab.research.google.com/drive/1aENKd7eemGqmjdB8Y6y... github: https://github.com/petopello/PSA blog: https://sudapollismo.substack.com/p/partial-sum-accumulation...

Does the same job

all alternatives →
  • Tally2019 · ▲76

    Predict live events. Win cash.

  • Tally: Sports Predictions2018 · ▲104

    Where sports fans predict outcomes and win cash

  • UB
    Using bots and maths to beat the sportsbooks2023 · whop.com · ▲13

    I have recently developed a bot capable of simultaneously scanning over 140+ sportsbooks around the globe. It analyzes millions of odds in real time and uses this data to find overpriced odds. The logic behind it is straightforward: it uses odds from all sportsbooks to calculate the probabilities of an event occurring. Then, with simple maths it determines if the expected value is positive, meaning the potential payout exceeds the risk. Unfortunately, sportsbooks limit your accounts once they realize that you are profitable and not a losing customer. So I have already been limited at more…

  • ScoreGenius2025 · ▲52

    World’s most accurate football betting prediction tool

  • BG
  • AE
    Analysing Euro 2024 betting odds with scraping and AI2024 · notebooks.nodescript.dev · ▲8

    I created a bot which analyses Euro 2024 betting odds and performs some basic analysis based on the recent form of each team and provides advice on which odds are under/over-priced by email to all subscribers. The intelligence of the bot is admittedly rather basic but this simple app shows how easy it is to reliably scrape and parse structured data with AI and perform insightful analysis. The initial version of the bot, shown in the notebook took about 15 minutes to build. Disclosure: this bot is built on our new graph based #nocode platform NodeScript.dev, which we've recently brought…

More commerce this month

the category →
  • Billing that survives a processor shutdown

    Commerce · 13d ago · paymentkit.com

  • Compare your startup equity grant for free.

    Commerce · 26d ago · equitybee.com

Launched alongside, February 2025

the whole month →
  • Beautiful screen recordings with instant shareable links

    Growth · 2025 · screen.studio

  • Tana1,666

    Put your notes to work with voice and AI

    AI · 2025 · tana.inc

  • IG

    I was at FB/Meta from late 2013 to early 2023, mostly working in the compiler/runtime spaces. I got hit in the spring 2023 layoff wave. I immediately started making games in my newfound free time (a lifelong interest, and I even worked in AA(A?) back ca. ~2000), and in October 2023 I stumbled upon the idea of a roguelike pachinko/plinko game inspired by Luck Be A Landlord. Things snowballed quickly, I started talking to publishers, then worked like crazy through all of 2024, almost the hardest I've ever worked in my career, and launched the game in December 2024. It's sold…

    Work · 2025

  • Tanka1,410

    AI Messenger with smart reply & long term memory for teams

    AI · 2025 · tanka.ai

  • Tool Finder1,327

    Your shortcut to better software

    AI · 2025 · toolfinder.com

  • IB

    i wanted to change the habit of reaching for my phone in the morning and doomscrolling away an hour so i built an app to help me. now i have to literally touch grass before accessing my most distracting apps the app is built in swiftui, uses the screen time apis provided by apple and google vision to recognise grass or not i'd love to get your thoughts on the concept.

    Life & fun · 2025 · touchgrass.now