Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. public class Game
  2. {
  3.  
  4.  
  5. private static int numPlayers;
  6. static Player[] players;
  7. private static int sum;
  8.  
  9.  
  10.  
  11. public static void main(String args[])
  12. {
  13. numPlayers = 2 ;
  14. players = new Player[numPlayers];
  15.  
  16. for (int i = 0; i<players.length;i++)
  17. {
  18. players[i] = new Player();
  19. }
  20.  
  21. players[0].setName("Mariana ");
  22. players[1].setName("Jimena ");
  23.  
  24. sum = 0;
  25. playRound();
  26. }
  27.  
  28.  
  29.  
  30. public static void playRound()
  31. {
  32. for(int i = 0; i<players.length;i++)
  33. {
  34. players[i].nextRandomGuess(numPlayers);
  35. int move = players[i].nextRandomMove();
  36. sum += move;
  37. printMove(players[i], move);
  38. }
  39.  
  40. }
  41.  
  42.  
  43. public static void printMove(Player _player, int _x)
  44. {
  45. System.out.println("EL jugador " + _player.getName() + "mostró " + _x );
  46.  
  47.  
  48. }
  49.  
  50. public static void printScores()
  51. {
  52. for(int i = 0; i<players.length;i++)
  53. {
  54. if(players[i].getGuess() == sum)
  55. players[i].setScore(1);
  56. }
  57.  
  58. }
  59.  
  60.  
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement