summaryrefslogtreecommitdiff
path: root/src/Q4/RandomSumGame.java
blob: e5b6ce0f4a0e197c2e131262c3a70fd13b87d872 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Q4;

import java.util.*;

public class RandomSumGame {
  private boolean start;
  private int d1;
  private int d2;
  private int sum;
  private int valuePoint;
  private String status;

  public void play(int d1, int d2) {}

  public void play() {
    this.rollDice();
    this.play(this.d1, this.d2);
  }

  public void rollDice() {
    this.d1 = this.roll();
    this.d2 = this.roll();
  }

  private int roll() {
    return new Random().nextInt(5) + 1;
  }
}