Skip to content

Instantly share code, notes, and snippets.

@MkLHX
Last active October 17, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MkLHX/c2d05e1da7d8b441249d502ec6c2d321 to your computer and use it in GitHub Desktop.
Save MkLHX/c2d05e1da7d8b441249d502ec6c2d321 to your computer and use it in GitHub Desktop.
<?php
/**
*
*le pistolet bat le poing mais perd contre le fouet
* gun > fists but gun < whip
*le poing bat le fouet mais perd contre le pistolet
* fists > whip but fists < gun
*le fouet bat le pistolet mais perd contre le poing
* whip > gun but whip < fists
*
*/
$weapons = ['fists', 'whip', 'gun'];
$opponentWeapon = $weapons[rand(0, 2)]; // Cela permet de choisir une arme de manière aléatoire.
switch ($opponentWeapon) {
case 'gun':
$indyWeapon = 'whip';
break;
case 'fists':
$indyWeapon = 'gun';
break;
case 'whip':
$indyWeapon = 'fists';
break;
default:
break;
}
$result = "<p>";
$result .= "Opponent attack : " . $opponentWeapon . "<br>";
$result .= "Indy riposte : " . $indyWeapon;
$result .= "</p>";
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment