ColorShapeLinks AI
An AI competition for the IEEE Conference on Games 2021
|
Represents the game board. More...
Public Member Functions | |
Board (int rows=6, int cols=7, int piecesInSequence=4, int roundPieces=10, int squarePieces=11) | |
Creates a new board. More... | |
int | DoMove (PShape shape, int col) |
Make a move, return row More... | |
Move | UndoMove () |
Undo last move. More... | |
Winner | CheckWinner (Pos[] solution=null) |
Check if there is a winner. More... | |
Board | Copy () |
Returns a copy of this board which can be freely modified by the AI in a different thread. More... | |
int | PieceCount (PColor color, PShape shape) |
Get number of remaining pieces with the given color and shape. More... | |
bool | IsColumnFull (int col) |
Is the specified column full? More... | |
Public Attributes | |
readonly int | rows |
Number of rows in the board. More... | |
readonly int | cols |
Number of columns in the board. More... | |
readonly int | piecesInSequence |
How many pieces in sequence to find a winner. More... | |
readonly int | roundPieces |
Initial number of round pieces for each player. More... | |
readonly int | squarePieces |
Initial number of square pieces for each player. More... | |
readonly IEnumerable< IEnumerable< Pos > > | winCorridors |
Array of win corridors, which can be used for building an heuristic. More... | |
Properties | |
Piece? | this[int row, int col] [get] |
Read-only indexer for allowing the board contents to be accessed by external code. More... | |
PColor | Turn [get] |
Who's turn is it? More... | |
Represents the game board.
|
inline |
Creates a new board.
rows | Number of rows. |
cols | Number of columns. |
piecesInSequence | Number of required pieces in a row for player to win. |
roundPieces | Initial number of round pieces per player. |
squarePieces | Initial number of square pieces per player. |
Check if there is a winner.
solution | Optional parameter where solution will be placed if there is a winner. |
|
inline |
Returns a copy of this board which can be freely modified by the AI in a different thread.
|
inline |
Make a move, return row
shape | Shape of piece used in move (color is obtained from Turn). |
col | Column where to drop piece. |
InvalidOperationException | Thrown when:
|
bool IsColumnFull | ( | int | col | ) |
Is the specified column full?
col | The column to check if it's full. |
true
if the column is full, false
otherwise. Get number of remaining pieces with the given color and shape.
color | Pieces color. |
shape | Pieces shape. |
readonly int cols |
Number of columns in the board.
readonly int piecesInSequence |
How many pieces in sequence to find a winner.
readonly int roundPieces |
Initial number of round pieces for each player.
readonly int rows |
Number of rows in the board.
readonly int squarePieces |
Initial number of square pieces for each player.
readonly IEnumerable<IEnumerable<Pos> > winCorridors |
Array of win corridors, which can be used for building an heuristic.
|
get |
Read-only indexer for allowing the board contents to be accessed by external code.
null
if no piece is in the given position. IndexOutOfRangeException | Thrown when the given position is invalid (outside the board). |
|
get |
Who's turn is it?
The color of the player who's currently playing.