Skip to content

Instantly share code, notes, and snippets.

@sidcool1234
Last active June 11, 2021 08:33
Show Gist options
  • Save sidcool1234/524776969f8e2ff6b3d66dea025fe183 to your computer and use it in GitHub Desktop.
Save sidcool1234/524776969f8e2ff6b3d66dea025fe183 to your computer and use it in GitHub Desktop.
enum COLOR {
WHITE, BLACK
}
enum PIECE {
NONE, BISHOP, KING // etc.
}
class Cell {
private COLOR color; // Enum, white or black
private PIECE piece;
public Cell(COLOR color, PIECE piece) {
this.color = color;
this.piece = piece;
}
public void setPiece(PIECE piece) {
// validations
this.piece = piece;
}
// much more functionality
}
class ChessBoard {
private List<Cell> cells;
private String theme;
public ChessBoard(List<Cell> cells, String theme) {
this.cells = cells;
this.theme = theme;
}
// much more functionality
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment