Last active
October 17, 2018 17:46
-
-
Save MkLHX/c2d05e1da7d8b441249d502ec6c2d321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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