Skip to content

Instantly share code, notes, and snippets.

@sele-nap
Created March 24, 2022 21:55
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 sele-nap/4061f8b79c4ee59401bde8b86734bb27 to your computer and use it in GitHub Desktop.
Save sele-nap/4061f8b79c4ee59401bde8b86734bb27 to your computer and use it in GitHub Desktop.
WCS quest // 5. Les conditions en PHP
<?php
$weapons = ['fists', 'whip', 'gun'];
$opponentWeapon = $weapons[rand(0,2)];
switch ($opponentWeapon) {
case 'fists' :
$indyWeapon = 'gun';
break;
case 'whip' :
$indyWeapon = 'fists';
break;
case 'gun' :
$indyWeapon = 'whip' ;
break;
}
echo "The enemy attacks with : -$opponentWeapon- ... Indi counterattacks with -$indyWeapon- ! ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment