承接 ivebe/tombola 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ivebe/tombola

Composer 安装命令:

composer require ivebe/tombola

包简介

Ticket generator for tombola gambling game

README 文档

README

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.

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.

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.

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:

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.

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

统计信息

  • 总下载量: 344
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固