unglud/slot-machine
最新稳定版本:v0.2
Composer 安装命令:
composer require unglud/slot-machine
包简介
Simple slot machine algorithm
README 文档
README
Simple slot machine algorithm.
This is a simple tech demo for slot machine algorithm for PHP.
Installation
Laravel Image is distributed as a composer package. So you first have to add the package to your composer.json file:
{
"require": {
"unglud/slot-machine": "@dev"
}
}
Usage
For start you need create Payout and test it
$slot = new SlotMachine([1000,500,300,200,150,100,60,50,40,1]); $slot->spin(); /* array:3 [ 0 => "j" 1 => "i" 2 => "d" ] */
You can test you Payout and see probabilities In result you will see something like this
dd($slot->testPayout());
array:11 [
"a|1" => 0.0476837158203
"b|3" => 0.643730163574
"c|5" => 1.78813934326
"d|7" => 3.27110290527
"e|9" => 5.21421432495
"f|11" => 6.34670257568
"g|13" => 6.28566741943
"h|15" => 8.04662704468
"i|17" => 9.37080383301
"j|47" => 4.95066642761
"total" => "45.97%"
]
Probabilities generates automatically based on Arithmetic progression, but you can set it manually on second argument:
$probs = [
'a'=>4,
'b'=>40,
'c'=>84
];
$slot = new SlotMachine([10,5,1], $probs);
More to come
Later I'll write more about theory.
License
Laravel Image is released under the MIT Licence. See the bundled LICENSE file for details.
统计信息
- 总下载量: 97
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-06