fork(1) download
  1.  
  2.  
  3. <?php
  4.  
  5.  
  6. $humanDice1 = mt_rand(1, 6);
  7. $humanDice2 = mt_rand(1, 6);
  8. $humanResult = $humanDice1 + $humanDice2;
  9.  
  10. $aiDice1 = mt_rand(1, 6);
  11. $aiDice2 = mt_rand(1, 6);
  12. $aiResult = $aiDice1 + $aiDice2;
  13. echo "Human get: $humanResult\n";
  14. echo "AI get: $aiResult\n";
  15.  
  16. if (($aiDice1 == $aiDice2) && ($humanDice1 == $humanDice2)) {
  17. echo "DOOOOUBLES!!! WHAT A LUCK U ARE BOTH ARE WINNERS!!!";
  18. } elseif($aiResult > $humanResult) {
  19. echo "AI is a WINNER";
  20. } elseif ($aiResult < $humanResult) {
  21. echo "Human is a WINNER";
  22. } elseif ($aiResult = $humanResult) {
  23. echo "Look's like we have a TIE";
  24. }
  25. exit();
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout

Human get: 5
AI get: 5
Look's like we have a TIE