Skip to content

Instantly share code, notes, and snippets.

<?php
$velocities = array("turtle", "donkey", "rabbit");
$mode = isset($argv[1]) ? $argv[1] : 'console';
$file = isset($argv[2]) ? $argv[2] : '';
$fp = null;
$raceWriters = array(
'file' => function($output)use($file, $fp){
if(!$fp) $fp = fopen($file, 'a+');
<?php
$velocities = array("turtle", "donkey", "rabbit");
$mode = $argv[1];
$file = $argv[2];
$output = '';
$players = array(
'1' => array(
'name' => 'Foo',
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)],
'actions' => array(),
),
'2' => array(
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'actions' => array(),
'2' => array(
'name' => 'Bar',
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'2' => array(
'name' => 'Bar',
'velocity' => $velocities[rand(0,2)]),
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'2' => array(
'name' => 'Bar',
'velocity' => $velocities[rand(0,2)]),
<?php
$velocities = array("turtle", "donkey", "rabbit");
$players = array(
'1' => array(
'name' => 'Foo',
'velocity' => $velocities[rand(0,2)]),
'2' => array(
'name' => 'Bar',
'velocity' => $velocities[rand(0,2)]),