Skip to content

Instantly share code, notes, and snippets.

View mgldev's full-sized avatar

Michael Leach mgldev

View GitHub Profile
@mgldev
mgldev / gist:6437221
Last active December 22, 2015 07:19
A colleague set a task of creating a Rock, Paper, Scissors game for our junior developers to tackle, and I thought I'd give it a shot.
<?php
$pieces = ['r' => 'Rock', 'p' => 'Paper', 's' => 'Scissors'];
$stack = [[['p','r'],'p'],[['r','s'],'r'],[['s','p'],'s']];
$takes = 5;
function request_player_piece() {
global $pieces;
echo "\nChoose piece: ";
$playerPiece = strtolower(trim(fgets(STDIN)));