Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- import java.util.Random;
- public class Backgammon {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- Random r = new Random();
- int x, y;
- for(int i = 0;;i++)
- {
- x = 1 + r.nextInt(6);
- y = 1 + r.nextInt(6);
- if(((x == 5) && (y == 6)) || ((x == 6) && (y == 5)))
- {
- System.out.printf("Backgammon! It took %d tries to reach this result", i);
- break;
- }
- }
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement