session_start(); include 'config.php'; function is_intval($value) { return 1 === preg_match('/^[+-]?[0-9]+$/', $value); } //initialize the names of lizards, then place them in a random order $namearray = array('Spot', 'Ralph', 'Speedy', 'Julio', 'Stripes', 'Gizmo', 'Raphael', 'Samuel', 'Charlie', 'Lizzie', 'Toast', 'Lightning', 'Jon Jon', 'Jerry', 'Sparky', 'Felix', 'Frodo', 'Franklin', 'Carrot', 'Bluefoot', 'Cinderella', 'Larry', 'Lulu', 'Mandy', 'Comet', 'Asteroid', 'Spike', 'Killer', 'Brutus', 'Dano', 'Princess', 'Duchess', 'Carl', 'Fluffy', 'Rex', 'Mary', 'Minnie', 'Draco', 'Bruiser', 'Stretch', 'Arnie', 'Loverboy', 'Tim', 'Tiny', 'Flash'); shuffle($namearray); //set up the odds that might be associated with a lizard. randomize them. $randchance = rand(1,4); switch($randchance){ case 1: $oddsarray = array(5, 10, 16, 16, 20, 33); break; case 2: $oddsarray = array(2, 8, 10, 10, 20, 50); break; case 3: $oddsarray = array(10, 10, 10, 20, 25, 25); break; case 4: $oddsarray = array(5, 10, 15, 15, 25, 30); break; } shuffle($oddsarray); function getOdds($oddsnum){ //this function shows the text label of the numerical odds of winning switch($oddsnum){ case 5: $oddsnum = '20 to 1'; break; case 10: $oddsnum = '10 to 1'; break; case 16: $oddsnum = '6 to 1'; break; case 15: $oddsnum = '5 to 3'; break; case 20: $oddsnum = '5 to 1'; break; case 33: $oddsnum = '3 to 1'; break; case 2: $oddsnum = '50 to 1'; break; case 8: $oddsnum = '12 to 1'; break; case 50: $oddsnum = '2 to 1'; break; case 25: $oddsnum = '4 to 1'; break; case 30: $oddsnum = '10 to 3'; break; } return $oddsnum; } $pagetitle='Lizard races at the Red Dragon Inn'; ?>