Guest User

Untitled

a guest
Oct 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. package dicegame;
  2.  
  3. import java.util.Random;
  4.  
  5.  
  6. public class DiceGame {
  7.  
  8.  
  9. public static void main(String[] args) {
  10.  
  11. Random dice = new Random();
  12. int number,
  13. guess;
  14.  
  15.  
  16. Player player = new Player();
  17. player.name = "Andrzej";
  18.  
  19. do {
  20. number = dice.nextInt(6) + 1;
  21. System.out.println("Wylosowane (number): " + number);
  22.  
  23. guess = dice.nextInt(6) + 1;
  24. System.out.println("Strzał (guess): " + guess);
  25.  
  26. if (number == guess) {
  27. System.out.println("BRAWO!");
  28. } else {
  29. System.out.println("PUDŁO!");
  30. }
  31.  
  32. System.out.println("Strzał gracza " + player.name + ": " + guess);
  33.  
  34. } while (number != guess);
  35. }
  36.  
  37. }
Add Comment
Please, Sign In to add comment