No description
Find a file
Maximilian Keßler 5b4a9ef06b implement better batch insertion for seeds for speedup
This should be a ~4x speedup (measured this) in seed insertion to DB,
because we have bigger, but less transactions.
2025-09-05 15:56:12 +02:00
go.mod initial commit: deck geerator 2025-07-17 09:50:50 +02:00
go.sum initial commit: deck geerator 2025-07-17 09:50:50 +02:00
LICENSE license 2025-08-13 15:39:30 +02:00
main.go implement better batch insertion for seeds for speedup 2025-09-05 15:56:12 +02:00
README.md Add README explaining usage 2025-08-10 00:08:38 +02:00
word_list.txt initial commit: deck geerator 2025-07-17 09:50:50 +02:00

Hanabi Deck Generator

This is go code to generate shuffles of Hanabi decks in the same way that hanab.live does. For my seed analysis project, I wanted to use seeds that can also be found on the website, so I had to use the sandom pseudo-random number generator as the website does. As it turns out, hanab.live uses a go module for this which (to my knowledge) is not available somewhere else, so this code is written in go as well and writes seeds to the database.

This code assumes the database format from the PyHanabi Project.

How exactly are the seeds geerated here?

We could just pick random names and generate seeds. However, we also want a method that gives us a reproducible methods to do things like "give me the first 100,000 seeds of some kind". I also wanted seeds to have pronouncible three-word-names that are sufficiently distinct to each other (even after factoring out player counts). That is why the following approach is used:

  • For each variant, we just number seeds 0,1,...
  • Each number (a 32-bit integer) is put through some bijective function returning another 32-bit integer (We just use RC5 here, we don't need security)
  • The resulting 32-bit number is written as a 3-word combination using a fixed word list of length ´ceil(2^(32/3)) = 1626´. This is then the seed name.
  • We use the seed name to feed the deck-generating algorithm from hanab.live (which is re-implemented here)

This results in each seed being identifiable by either of these:

  • By its unique name (something like p4v0sapple-banana-carrot), which would be used by hanab.live and suffices to compute the shuffle
  • Its player count and numbering

In particular, the number and the seed name determine each other uniquely.

So, to reproduce the same seeds that I used for my experiments, it suffices to know which numbering range were used for those (typically just from 0 onwards), from which all the seed names and their shuffles can be uniquely computed by the code in this repository.