Guest User

Untitled

a guest
Jun 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class Alice_Bob {
  4. public static void main(String args[]){
  5. int Alice = 0;
  6. int Bob = 0;
  7. int count = 0;
  8. for(int i = 0; i<1000; i++){
  9. if(contest()){
  10. Bob++;
  11. count++;
  12. }
  13. else{
  14. Alice++;
  15. count++;
  16. }
  17. }
  18. System.out.println(Alice + " " + Bob + " " + count);
  19. }
  20. public static boolean contest(){
  21. Random diceRoller = new Random();
  22. while(true){
  23. int randomInt = diceRoller.nextInt(15) + 1;
  24. System.out.println(randomInt);
  25. if(randomInt == 1){
  26. return false;
  27. }
  28. if(randomInt % 2 == 0){
  29. /* if(diceRoller.nextInt(15) + 1 % 8 == 0){
  30. * return true;
  31. */ }
  32. return(true);
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment