-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomino.java
More file actions
30 lines (25 loc) · 777 Bytes
/
Domino.java
File metadata and controls
30 lines (25 loc) · 777 Bytes
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
/**
* Represents a physical domino tile with two numeric sides (pips).
*/
public class Domino {
public final int a, b; // The values on each end of the domino.
public final boolean symmetric; // do the pips values on this domino match?
/**
* Constructor to initialize a domino tile.
* @param a The value on the first side.
* @param b The value on the second side.
*/
public Domino(int a, int b) {
this.a = a;
this.b = b;
this.symmetric = a==b;
}
/**
* Returns a string representation of the domino, e.g., "3-5".
* Useful for debugging and printing results to the console.
*/
@Override
public String toString() {
return a + "-" + b;
}
}