sixteenstudio/poker
Composer 安装命令:
composer require sixteenstudio/poker
包简介
A PHP-based poker libary, with hand strength calculations, texas holdem game logic and more.
README 文档
README
A PHP-based Poker library capable of hand calculations, Texas Hold'em game logic and more
Cards and Decks
The poker library retains a fairly simplified class structure, providing you with a simple card class which can be swapped out for any card implementation that follows its interface, allowing you to implement your own suits and even your own description translations.
$cards = [ new Card('Club', 1), new Card('Spade', 2), new Card('Club', 3), new Card('Heart', 4), new Card('Diamond', 5), ]; $deck = new Deck($cards);
A Deck is a collection of cards that provides shuffle, take card, card count functions and any other functions that might be necessary when building a poker game.
A standard 52 card deck can be instantiated using the static newStandardDeck method
$52CardDeck = Deck::newStandardDeck();
Hands and HandStrengths
Hands are made from a particular number of cards, of which the limit depends on the type of game. The default Hand class sets a limit of 2 cards, as this is the standard Texas Hold'em hand card count.
$hand = new Hand([$deck->takeCard(), $deck->takeCard()]);
If an invalid hand is made (i.e. more than 2 cards are added to the hand), an Sixteenstudio\Poker\InvalidHandException will be thrown.
A hand is not to be confused with a hand strength, which is where the strongest hand dependant on a player's hand and any community cards is calculated. This class is currently still under development.
HandStrength instances will be useful because they can calculate, using any provided playable cards, what the strongest hand is that can be made, using only a small amount of method calls.
It will also allow a comparison between other HandStrength classes, which allows a Game class to calculate who the winning player is in any given situation.
Game
The Game class, which is currently under development, is an abstract class which will provide a framework for card based games (that means not only Poker!) that can be re-used for any number of games.
It will hold player information, game states and essentially the backend gameplay logic required to run a game server.
An Laravel 4.2 based application built using Socketier, MongoDB and this Poker library will be available soon, which will be an example of how an online poker room solution can be achieved using PHP.
Example
The environment application will be found in the sixteenstudio/poker-environment repository. This provides a vagrant-based environment built on Laravel 4.2 to fully test out the features of the poker library and the texas hold'em functionality.
sixteenstudio/poker 适用场景与选型建议
sixteenstudio/poker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 647 次下载、GitHub Stars 达 35, 最近一次更新时间为 2015 年 01 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「poker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sixteenstudio/poker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sixteenstudio/poker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sixteenstudio/poker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A comprehensive PHP library for working with Poker data and operations.
Alfabank REST API integration
Poker hand evaluator bundle for Symfony3
Results manager for poker and other card games.
generate poker data.
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
统计信息
- 总下载量: 647
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 35
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-14