定制 atsmacode/poker-game 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

atsmacode/poker-game

最新稳定版本:v4.0.6

Composer 安装命令:

composer create-project atsmacode/poker-game

包简介

A PHP Based Poker Game

README 文档

README

A database driven package that provides logic to drive a basic Texas Hold-Em poker game.

It can be pulled in via composer to be used within a parent front-end package, but could also be used within an independent container as an API.

A brief description of how it works is:

  • The SitController starts a new Hand
  • The PlayerActionController accept a Request containing information on which Hand is being played, and what the last thing to happen was (who was the last to act and what action did they take)
  • This data is passed to the ActionHandler which updates the status of all players accordingly and returns a GameState object containing all the information of the current Hand
  • The GameState is passed to a GamePlay class which decides what should happen next in the Hand
  • Depending on what the next step is, the logic is delegated to respective HandStep interfaces which carry out the appropriate process for each thing:
    • The players are still betting on a street
    • A new street card should be dealt
    • All bets have been called on the river and we have reached showdown
    • A new Hand should be started
  • If we have reached showdown, the Showdown class decides the winner by calling the HandIdentifier which identifies and ranks each hand the players have based on the ranking of active cards (a King would be the active card in a pair of Kings hand, for example) and kickers
  • The updated GameState is returned

It is by no means a finished poker game. Here are some of the things it does not yet do:

  • Split and side pots
  • All-ins
  • No-limit betting
  • Game winners/losers as opposed to Hand winners/losers
  • Incrementing blinds and antes

The testing is primarily based on Feature tests where I've set-up a range of scenarios.

Documentation

I've saved some examples of how I plan and map out changes using Lucid Charts:

Improvments

Planning

Environment

PHP

8.1.3

MySQL

8.0.13

Commands

Linux

Build the test DB:

dev/builddb

Run the unit test suite:

dev/phpunit

Individual Drop, Create and Seed commands. Remove '-d true' for prodution:

php dev/PokerGameApp.php app:create-database -d true

php dev/PokerGameApp.php app:build-card-games -d true

php dev/PokerGameApp.php app:build-poker-game -d true

Windows

Drop, Create and Seed all tables:

.\dev\builddb.bat

Run the unit test suite:

.\dev\runtests.bat

Individual Drop, Create and Seed commands. Remove '-d true' for prodution:

php .\dev\PokerGameApp.php app:create-database -d true

php .\dev\PokerGameApp.php app:build-card-games -d true

php .\dev\PokerGameApp.php app:build-poker-game -d true

Laragon

Using Laragon, the following example path to run PHP might be useful:

C:\laragon\bin\php\php-8.1.3-nts-Win32-vs16-x64/php

Configs

You need to add poker_game.php to configure your local DB credentials and log path, like so:

<?php

return [
    'poker_game' => [
        'db' => [
            'live' => [
                'servername' => 'localhost',
                'username'   => 'DB_USER',
                'password'   => 'DB_PASSWORD',
                'database'   => 'poker_game',
                'driver'     => 'pdo_mysql',
            ],
            'test' => [
                'servername' => 'localhost',
                'username'   => 'DB_USER',
                'password'   => 'DB_PASSWORD',
                'database'   => 'poker_game_test',
                'driver'     => 'pdo_mysql',
            ],
        ],
        'logger' => [
            'path' => '/your/log/file'
        ]
    ],
];

atsmacode/poker-game 适用场景与选型建议

atsmacode/poker-game 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 199 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 11 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 atsmacode/poker-game 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 atsmacode/poker-game 我们能提供哪些服务?
定制开发 / 二次开发

基于 atsmacode/poker-game 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-11-27