package
xo;
import static
java.util.Objects.
requireNonNull
;
public final class
Game {
private final
Board
board
;
private final
Player
player1
;
private final
Player
player2
;
private
State
state
= State.
PLAYER_1_MOVE
;
public
Game(Board board, Player player1, Player player2) {
this
.
board
requireNonNull
(board,
"board == null"
);
this
.
player1
requireNonNull
(player1,
"player1 == null"
);
this
.
player2
requireNonNull
(player2,
"player2 == null"
);
}
//
TODO mutator methods...
@Override
public boolean
equals(Object o) {
if
(
this
== o)
return true
;
if
(!(o
instanceof
Game))
return false
;
Game other = (Game) o;
return
board
.equals(other.
board
)
&&
player1
.equals(other.
player1
)
&&
player2
.equals(other.
player2
)