Ticket generator for tombola gambling game
Tombola is popular gambling game which consist of tables with 6 tickets. In each table there is 90 numbers, and each ticket contains 15 numbers. This package is PHP implementation with help of harrysethi/Tambola-Ticket-Generator
explanation and java implementation., (*1)
Install using composer., (*2)
composer require ivebe/tombola
Just require composer autoloader if it's not already in your project, and following example will print simple table with 6 tickets., (*3)
require_once __DIR__ . '/vendor/autoload.php'; use Ivebe\Tombola\Table; $table = new Table(); $table->generate(); $table->prettyPrint();
If you wish to get array of tickets and their numbers in order to further customize tickets, you can get it like this:, (*4)
require_once __DIR__ . '/vendor/autoload.php'; use Ivebe\Tombola\Table; $table = new Table(); $table->generate(); foreach( $table->getTickets() as $ticket ){ $numbers = $ticket->getNumbers(); //do something with it }
There is also Test
class which will verify table and return boolean true/false
. You can use this and check is table valid. If it's not generate new table. It accepts array of tickets, and expect exactly 6 tickets of a single table. Why not pass Table
object instead? It's done so that you can modify tickets, and verify that integrity of table is still intact., (*5)
require_once __DIR__ . '/vendor/autoload.php'; use Ivebe\Tombola\Table; use Ivebe\Tombola\Test; $table = new Table(); $table->generate(); $tickets = $table->getTickets(); var_dump(Test::verify($tickets));
MIT, (*6)