bingo-card-generator
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Welcome to bingo-card-generator

Version License: ISC

Simple generator for 90-ball bingo cards, in strips of 6 tickets.

Based upon an algorithm description by Mark Henderson from: http://www.fractalforums.com/non-fractal-related-chit-chat/90-number-bingo-ticket-algorithm/

Install

npm install

Exports a number of TypeScript types, most of which are used internally, and are just type-names for number arrays.

  • TCell = number|undefined
  • TRow = TCell[9]
  • TColumn = TCell[3]
  • TTicket = TRow[3]
  • TStrip = TTicket[6]

Ticket gaps are represented by undefined; ticket numbers are regular numbers.

Ticket.generateStrip() is the main way to generate a strip of 6 tickets. As the tickets are generated iteratively, there is a chance the algorithm may get stuck in an impossible combination. Therefore there are TTLs employed to abort infinite loops. Default values are:

  • generationCycleTtl: number = 100000,
  • reattemptTtl: number = 20,
  • distributionCycleTtl: number = 100000

I've found using these combinations strip generation is almost guaranteed to succeed. However, it is still possible for it to not, so be aware that you may need to catch exceptions.

Author

👤 Pete Morris

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

Readme

Keywords

none

Package Sidebar

Install

npm i bingo-card-generator

Weekly Downloads

3

Version

2.0.0

License

ISC

Unpacked Size

21.7 kB

Total Files

29

Last publish

Collaborators

  • petemorris