承接 jarrett/rockpaperscissorsspocklizard 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jarrett/rockpaperscissorsspocklizard

Composer 安装命令:

composer require jarrett/rockpaperscissorsspocklizard

包简介

Based on a game created by Sam Kass and Karen Bryla and made popular by "Big Bang Theory"

README 文档

README

Build Status Code Coverage Scrutinizer Code Quality SensioLabsInsight

RockPaperScissorsSpockLizard Game (in PHP)

A PHP class implementation of Rock Paper Scissors Spock Lizard as created by Sam Kass and Karen Bryla and popularized by "Big Bang Theory."

Add as many players (or bots) as you want. Then play them all against each other at the same time!

Packagist can be found here: jarrett/rockpaperscissorsspocklizard

Getting Started

Install via composer:

composer install jarrett/rockpaperscissorsspocklizard

and require composer autoloader

require 'vendor/autoload.php';

Basic Example:

use Jarrett\RockPaperScissorsSpockLizard;
use Jarrett\RockPaperScissorsSpockLizard\Player;

// ...

$player = new Player();
$player->move('rock');

$bot = new Player();
$bot->isBot(true);

$game = new RockPaperScissorsSpockLizard();
$game->addPlayers($player, $bot)
     ->play();
     
$outcome = $game->getOutcomes();    

2 Player Example:

use Jarrett\RockPaperScissorsSpockLizard;
use Jarrett\RockPaperScissorsSpockLizard\Player;

// ...

$player1 = new Player();
$player1->move('rock');

$player2 = new Player();
$player2->move('scissors');

$game = new RockpaperScissorsSpockLizard();
$game->setRounds(3)
     ->addPlayers($player1, $player2);
     ->play();

$outcome = $this->getOutcomes()

5 Player Example:

use Jarrett\RockPaperScissorsSpockLizard;
use Jarrett\RockPaperScissorsSpockLizard\Player;

// ...

// human
$player1 = new Player();
$player1->move('rock');

// human
$player2 = new Player();
$player2->move('paper');

// and 3 bots
$player3 = new Player();
$player4 = new Player();
$player5 = new Player();

$game = new RockpaperScissorsSpockLizard();
$game->addPlayers($player1, $player2, $player3, $player4, $player5)
     ->play();

// returns an array containing all wins, ties, and losses
$outcomes = $this->getOutcomes()

... or just throw the player instantiation directly into the addPlayers() method

$game = new RockpaperScissorsSpockLizard();
$game->addPlayers($player1, $player2, (new Player), (new Player), (new Player))
         ->play();

Class Method Reference:

Player( string $player_name )

move( string $move)

Set your move

setName()

Set player name. Can also be passed via the constructor. Generic "Player 1, 2, 3" will be used if name is empty.

getName()

Get player name.

getMoveHistory()

Get player's move history

getLastMove()

Get player's last move

RockPaperScissorsSpockLizard()

play()

Play the round

restart()

Restarts the game

setRounds( string $number, bool $lock = false)

Set the number of rounds for this game. Default is 1 if not specified.

Parameters
$number integer
  • The maximum number of rounds before a winner is chosen
$lock bool
  • If true, don't allow the number of rounds to change for this game
  • If false (default), the maximum number of rounds can be changed during the game, even after a winner is determined.

getRounds()

Returns all round results.

getOutcome()

Returns last round outcome.

addPlayer()

Add player to the game.

addPlayers()

Add multiple players to the game.

getPlayers()

Return players for game.

getTotalPlayers()

Returns the number of players playing

getRoundWinner()

Returns the player who won the last round.

getOutcomes()

Returns the outcomes for all players.

getWinners()

Returns the player who won the game.

jarrett/rockpaperscissorsspocklizard 适用场景与选型建议

jarrett/rockpaperscissorsspocklizard 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 jarrett/rockpaperscissorsspocklizard 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: HTML

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2017-08-29