Download the PHP package jarrett/rockpaperscissorsspocklizard without Composer

On this page you can find all versions of the php package jarrett/rockpaperscissorsspocklizard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rockpaperscissorsspocklizard

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

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.


All versions of rockpaperscissorsspocklizard with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jarrett/rockpaperscissorsspocklizard contains the following files

Loading the files please wait ....