summaryrefslogtreecommitdiff
path: root/base/src/bjc/dicelang/dice/Die.java
blob: 630e8b9d5ccaa0d9d36daa16a81a6cabd68fa89d (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
29
30
31
32
33
34
35
36
37
38
39
package bjc.dicelang.dice;

/**
 * Represents one or more dice that produce a scalar result.
 *
 * @author Ben Culkin
 */
public interface Die {
	/**
	 * Can this die be optimized to a single number?
	 *
	 * @return Whether this die can be optimized or not.
	 */
	boolean canOptimize();

	/**
	 * Optimize this die to a single number.
	 *
	 * Calling optimize on dice that return false for canOptimize produces
	 * undefined behavior
	 *
	 * @return The optimized form of this die
	 */
	long optimize();

	/**
	 * Roll this die.
	 *
	 * @return A possible roll of this die
	 */
	long roll();

	/**
	 * Roll only a single portion of this die.
	 *
	 * @return A possible roll of a single portion of this die.
	 */
	long rollSingle();
}