2017 © Pedro Peláez
 

library tombola

Ticket generator for tombola gambling game

image

ivebe/tombola

Ticket generator for tombola gambling game

  • Wednesday, February 15, 2017
  • by ivebe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Ivebe/Tombola Build Status

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)

Rules

  • One table consist of 6 tickets.
  • It must have all numbers from 1 to 90, and they must be used only once
    • 1st column, numbers from 1 to 9
    • 2nd-8th column, numbers from 20-29, 30-39 ... 80-89
    • 9th column numbers from 80 to 90
  • each row has exactly 5 numbers
  • each column must have at least one number

Installation

Install using composer., (*2)

composer require ivebe/tombola

Usage

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));

License

MIT, (*6)

The Versions

15/02 2017

dev-master

9999999-dev

Ticket generator for tombola gambling game

  Sources   Download

MIT

The Requires

  • php >=5.5

 

by Danijel Petrovic

15/02 2017

0.0.1

0.0.1.0

Ticket generator for tombola gambling game

  Sources   Download

MIT

The Requires

  • php >=5.5

 

by Danijel Petrovic