Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. $X = $_POST['X'];
  2. $Y = rand(1, 3);
  3. $A = $X-$Y+3;
  4. $R = fmod($A, 3);
  5.  
  6. if ($R == 0) {
  7. echo 'draw!';
  8. } elseif ($R == 1) {
  9. echo 'you won!';
  10. } elseif ($R == 2) {
  11. echo 'you lost!';
  12. } else {
  13. echo 'an error occurred!';
  14. }
  15.  
  16. Table: Users
  17.  
  18. UserID Username (I don't include email, password and salt here...)
  19. 1 Espen
  20. 2 Test
  21.  
  22. Table: Games
  23.  
  24. GameID Participant1 Participant2 Winner
  25. 1 1 2 1
  26. 1 1 2 2
  27.  
  28. Table: Moves
  29.  
  30. MoveID GameID UserID Move
  31. 1 1 1 2
  32. 2 1 2 1
  33. 3 2 1 3
  34. 4 2 2 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement