Git Product home page Git Product logo

slot-machine's Introduction

Slot Machine

Simple slot machine algorithm.

This is a simple tech demo for slot machine algorithm for PHP.

GitHub release Build Status License Total Downloads

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.

slot-machine's People

Watchers

James Cloos avatar upzone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.