bingwow
v1.0.0
Published
Generate bingo cards from any topic. Shuffled grids in 3x3, 4x4, or 5x5 layouts with customizable free-space support. Used in production by bingwow.com.
Maintainers
Readme
bingwow
Generate bingo cards from any list of items. Shuffled 3×3, 4×4, or 5×5 grids with optional FREE space.
Used in production by bingwow.com.
Install
npm install bingwowUsage
const { generateCard, generateCards, formatCard } = require('bingwow');
const card = generateCard({
items: ['cat', 'dog', 'fish', 'bird', 'hamster', 'rabbit', 'turtle', 'lizard',
'snake', 'frog', 'parrot', 'gerbil', 'pony', 'goat', 'duck', 'pig',
'cow', 'sheep', 'goose', 'chicken', 'horse', 'donkey', 'llama', 'alpaca'],
gridSize: 5,
freeSpace: true,
});
console.log(formatCard(card));+------------------+------------------+------------------+------------------+------------------+
| cat | duck | llama | gerbil | hamster |
+------------------+------------------+------------------+------------------+------------------+
| goose | goat | sheep | lizard | cow |
+------------------+------------------+------------------+------------------+------------------+
| pony | bird | FREE | pig | fish |
+------------------+------------------+------------------+------------------+------------------+
| snake | turtle | donkey | alpaca | rabbit |
+------------------+------------------+------------------+------------------+------------------+
| frog | chicken | parrot | dog | horse |
+------------------+------------------+------------------+------------------+------------------+API
generateCard({ items, gridSize, freeSpace, freeSpaceText })
| Option | Type | Default | Description |
|---|---|---|---|
| items | string[] | required | Pool of cell texts. Cycled if smaller than the grid. |
| gridSize | 3 \| 4 \| 5 | 5 | Grid dimension. |
| freeSpace | boolean | true | Place FREE in the center (odd grids only). |
| freeSpaceText | string | 'FREE' | Custom free-space label. |
Returns { grid, size, totalCells }.
generateCards({ items, count, ...options })
Generate count independently shuffled cards from the same pool. Returns an array.
formatCard(card, cellWidth?)
Render a card as printable ASCII. cellWidth defaults to 18.
License
MIT © Forrest Miller
