2017 © Pedro Pelรกez
 

symfony-bundle handevaluator-bundle

Poker hand evaluator bundle for Symfony3

image

bourdeau/handevaluator-bundle

Poker hand evaluator bundle for Symfony3

  • Sunday, May 22, 2016
  • by bourdeau
  • Repository
  • 0 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Build Status Dependency Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Poker Hand Evaluator Bundle

About Poker Hand Evaluator Bundle

Hand Evaluator Bundle is a PHP 5.6+ library providing services to evaluate Texas hold'em Poker Hands., (*2)

Installation

Prerequisites

A Symfony3 project, (*3)

With composer

This bundle can be installed using composer by adding the following in the require section of your composer.json file:, (*4)

``` json "require": { ... "bourdeau/handevaluator-bundle": "~0.1" },, (*5)


## Register the bundle You must register the bundle in your kernel: ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Bourdeau\Bundle\HandEvaluatorBundle\BourdeauBundleHandEvaluatorBundle(), ]; // ... }

Configuration

There is no configuration for now., (*6)

Usage Example

``` php <?php // Path/To/Your/Controller $winnerFinder = $this->container->get('bourdeau_bundle_hand_evaluator.winnerfinder'); $players = [ 'John' => [QH, 2S, QS, JH, 5D, KH, 2H], 'David' => [9S, 2D, QS, JH, 5D, KH, 2H], 'Robert' => [QD, QC, QS, JH, 5D, KH, 2H], ], (*7)

$result = $handFinder->findAWinner($players);, (*8)

// $result will output: โ”‚ array(2) { โ”‚ ["winners"]=> โ”‚ array(1) { โ”‚ ["Robert"]=> โ”‚ array(4) { โ”‚ ["hand_name"]=> โ”‚ string(15) "Three of a kind" โ”‚ ["hand_rank"]=> โ”‚ int(4) โ”‚ ["card_rank"]=> โ”‚ int(11) โ”‚ ["cards"]=> โ”‚ array(3) { โ”‚ [0]=> โ”‚ string(2) "QD" โ”‚ [1]=> โ”‚ string(2) "QC" โ”‚ [2]=> โ”‚ string(2) "QS" โ”‚ } โ”‚ } โ”‚ } โ”‚ ["other_players"]=> โ”‚ array(2) { โ”‚ ["John"]=> โ”‚ array(4) { โ”‚ ["hand_name"]=> โ”‚ string(9) "Two Pairs" โ”‚ ["hand_rank"]=> โ”‚ int(3) โ”‚ ["card_rank"]=> โ”‚ int(11) โ”‚ ["cards"]=> โ”‚ array(4) { โ”‚ [0]=> โ”‚ string(2) "QH" โ”‚ [1]=> โ”‚ string(2) "QS" โ”‚ [2]=> โ”‚ string(2) "2S" โ”‚ [3]=> โ”‚ string(2) "2H" โ”‚ } โ”‚ } โ”‚ ["David"]=> โ”‚ array(4) { โ”‚ ["hand_name"]=> โ”‚ string(8) "One Pair" โ”‚ ["hand_rank"]=> โ”‚ int(2) โ”‚ ["card_rank"]=> โ”‚ int(1) โ”‚ ["cards"]=> โ”‚ array(2) { โ”‚ [0]=> โ”‚ string(2) "2D" โ”‚ [1]=> โ”‚ string(2) "2H" โ”‚ } โ”‚ } โ”‚ } โ”‚ }, (*9)

```, (*10)

The Versions