Class GomokuBoard
java.lang.Object
GomokuBoard
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe height of the GomokuBoard.private intThe width of the GomokuBoard.private GomokuCellThe firstcell in the board, at the top left of the board. -
Constructor Summary
ConstructorsConstructorDescriptionGomokuBoard(int width, int height) This constructor take the width and the height to creat a board of gomoku.GomokuBoard(int width, int height, Color[][] colors) This constructor take the width and the height to creat a board of gomoku. -
Method Summary
Modifier and TypeMethodDescriptioncountAlignedCells(GomokuCell cell) This method return a Map of number aligned cells.intThis method return the number max of the aligned Cells.private voidThis method gen all cells in the board and link each other.get(int x, int y) This method get a cell in specific position in the board.private GomokuCell[][]This method return all cells in the board in the order.This method return a list of playable cell.static voidtoString()This method print the board cell by cell with change line when the line is finished.
-
Field Details
-
firstCell
The firstcell in the board, at the top left of the board. -
boardWidth
private int boardWidthThe width of the GomokuBoard. -
boardHeight
private int boardHeightThe height of the GomokuBoard.
-
-
Constructor Details
-
GomokuBoard
public GomokuBoard(int width, int height) This constructor take the width and the height to creat a board of gomoku.- Parameters:
width- Size of width.height- Size of height.
-
GomokuBoard
This constructor take the width and the height to creat a board of gomoku.- Parameters:
width- Size of width.height- Size of height.colors- Is colors of cells after load a game.
-
-
Method Details
-
main
-
genCells
This method gen all cells in the board and link each other.- Parameters:
width- Size of width.height- Size of height.colors- Array of Color.
-
get
This method get a cell in specific position in the board.- Parameters:
x- The position x on the board.y- The position y on the board.- Returns:
- GomokuCell in the position.
-
getAllsCells
This method return all cells in the board in the order.- Returns:
- All cells with a array 2D.
-
getPlayableCells
This method return a list of playable cell.- Returns:
- List of GomokuCell wich all is playable.
-
countAlignedCells
This method return a Map of number aligned cells.- Parameters:
cell- A cell.- Returns:
- Map of number aligned cells.
-
countMax
-
toString
-