Package | Description |
---|---|
clui |
This package contains the command-line user interface.
|
controller |
This package contains various controllers, which are strategies to select
the next move for a given player.
|
model |
this package contains all of the data structures used to model the
state of the five-in-a-row game, and for processing the rules of the game.
|
Modifier and Type | Method and Description |
---|---|
static Controller |
Main.createController(Player p)
Ask the user what kind of controller should play for p; create and
return the corresponding object.
|
Constructor and Description |
---|
ConsoleController(Player me) |
Modifier and Type | Method and Description |
---|---|
int |
SmartAI.score(Board b,
Player p)
return the positive score for player p
|
int |
SmartAI.score(Board b,
Player p,
Line s)
Return the score for player p, for the line s.
|
Constructor and Description |
---|
DumbAI(Player me) |
RandomAI(Player me) |
SmartAI(Player me) |
Modifier and Type | Field and Description |
---|---|
@NonNull Player |
Victory.winner |
Modifier and Type | Method and Description |
---|---|
Player |
Board.get(int row,
int col)
Return the player who has played in (r,c), or null if it is empty.
|
Player |
Board.get(@NonNull Location loc)
Return the player who has played in loc, or null if loc is empty.
|
@NonNull Player |
Game.nextTurn()
Return the player who should play next.
|
Player |
Player.opponent()
Return the player's opponent (X.opponent() == O and O.opponent() == X).
|
static Player |
Player.valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Player[] |
Player.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
Modifier and Type | Method and Description |
---|---|
void |
Game.submitMove(@NonNull Player p,
@NonNull Location loc)
Update the game in response to player p playing in location loc.
|
Board |
Board.update(@NonNull Player p,
@NonNull Location loc)
Return a new board that is the same as this with loc mapped to p.
|
Constructor and Description |
---|
Game(Player p)
Create a game with an empty board; p goes first.
|
Victory(@NonNull Player winner,
Line line)
Create a new Victory with the given winner and line.
|