diff --git a/assets/UML.drawio b/assets/UML.drawio new file mode 100644 index 0000000..c3d7ad0 --- /dev/null +++ b/assets/UML.drawio @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/UML.svg b/assets/UML.svg index e537f9d..c48e7ef 100644 --- a/assets/UML.svg +++ b/assets/UML.svg @@ -1,4 +1,4 @@ -

«Abstract»

Piece


- PieceColor: Color


+ Piece(Color)

+ getMoveDomain() : Direction[] 

+ getColor() : Color

+ getSymbol() : Char

+ getType() : Type

+ hasMoved() : bool

«Final»

Pawn


 + getMoveDomain() : Direction[]

«Final»

King


 + getMoveDomain() : Direction[]

«Final»

Queen


 + getMoveDomain() : Direction[]

«Final»

Rook


 + getMoveDomain() : Direction[]

«Final»

Bishop


 + getMoveDomain() : Direction[]

«Final»

Knight


 + getMoveDomain() : Direction[]

«Enum»

Type


Pawn
King
Queen

Rook

Bishop

Knight

«Enum»

Color


 White
 Black
Use

«Final»

ChessBoard


- Board: Piece[64]


+ ChessBoard()

+ getPiece(idx : int) : Piece

+ getPiece(x : int, y : int) : Piece

+ movePiece(from: int, to: int) : Optional<Move>

+ isCheck(color : Color) : bool

+ isCheckMate(color : Color) : bool

1
0..64
Use
Model
Controller

«Final»
ChessGame


- board: ChessBoard
- state: GameState

- view: GameView

- history: List<Move>


+ start(): void
+ processTurn(from: int, to: int) : void

+ getGameState() : GameState


- endTurn() : void

- switchPlayer() : void

- checkGameEnd() : void

«Final»

«Record»
GameState


activePlayer: Color
status: GameStatus


1
1

«Enum»

GameStatus


 ACTIVE
 WHITE_WINS
 BLACK_WINS
 STALEMATE
View

«Interface»
GameView


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

ConsoleView


- controller: ChessGame

- scanner: Scanner


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

SwingView


- controller: ChessGame

- frame: JFrame

- boardPanel: JPanel

- squares: JButton[64]


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

«implements»
«implements»

«Final»

«Record»

Move


 start: int
 end: int

 isCapture: bool

 isCastle: bool

 isEnPassant: bool

 isCheck: bool

  movedPiece: Type
  promotedTo: Type
  capturedPieceColor: Color
  capturedPieceType: Type
1
*
Service

PGNWriter


+ write(List<Move>): void

PGNReader


+ read(): List<Move>

Use
Use
\ No newline at end of file +

«Abstract»

Piece


- pieceColor: Color

- movedBefore: boolean


+ Piece(Color)

+ getMoveDomain() : Direction[] 

+ getColor() : Color

+ getSymbol() : Char

+ getType() : Type

+ hasMoved() : bool

«Final»

Pawn


 + getMoveDomain() : Direction[]

«Final»

King


 + getMoveDomain() : Direction[]

«Final»

Queen


 + getMoveDomain() : Direction[]

«Final»

Rook


 + getMoveDomain() : Direction[]

«Final»

Bishop


 + getMoveDomain() : Direction[]

«Final»

Knight


 + getMoveDomain() : Direction[]

«Enum»

Type


PAWN
KING
QUEEN

ROOK

BISHOP

KNIGHT

«Enum»

Color


 WHITE
 BLACK
Use

«Final»

ChessBoard


- board: Piece[64]


+ ChessBoard()

+ getPiece(idx : int) : Piece

+ getPiece(x : int, y : int) : Piece

+ movePiece(from: int, to: int) : Optional<Move>

+ isCheck(color : Color) : bool

+ isCheckMate(color : Color) : bool

1
0..64
Use
Model
Controller

«Final»
ChessGame


- board: ChessBoard
- state: GameState

- view: GameView

- history: List<Move>


+ start(): void
+ processTurn(from: int, to: int) : void

+ getGameState() : GameState


- endTurn() : void

- switchPlayer() : void

- checkGameEnd() : void

«Final»

«Record»
GameState


activePlayer: Color
status: GameStatus


1
1

«Enum»

GameStatus


 ACTIVE
 WHITE_WINS
 BLACK_WINS
 STALEMATE
View

«Interface»
GameView


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

ConsoleView


- controller: ChessGame

- scanner: Scanner


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

SwingView


- controller: ChessGame

- frame: JFrame

- boardPanel: JPanel

- squares: JButton[64]


+ displayBoard(board: ChessBoard): void
+ showMessage(msg: String) : void

+ showError(errorMsg: String) : void

+ showGameOver(status: GameStatus) : void

+ setController(controller: ChessGame) : void

«implements»
«implements»

«Final»

«Record»

Move


 start: int
 end: int

 isCapture: bool

 isCastle: bool

 isEnPassant: bool

 isCheck: bool

  movedPiece: Type
  promotedTo: Type
  capturedPieceColor: Color
  capturedPieceType: Type
1
*
Service

PGNWriter


+ write(List<Move>): void

PGNReader


+ read(): List<Move>

Use
Use

«Enum»

Direction


 NORTH
 SOUTH
 EAST
 WEST
 NORTH_EAST
 NORTH_WEST
 SOUTH_EAST
 SOUTH_WEST
 KNIGHT_NNE
 KNIGHT_ENE
 KNIGHT_ESE
 KNIGHT_SSE
 KNIGHT_SSW
 KNIGHT_WSW
 KNIGHT_WNW
 KNIGHT_NNW
 PAWN_DOUBLE_NORTH
 PAWN_DOUBLE_SOUTH

 - dx
 - dy

 + getDx() : int
 + getDy() : int
 + getFlatOffset() : int


Use
\ No newline at end of file diff --git a/assets/UML_dark.png b/assets/UML_dark.png deleted file mode 100644 index 5329b99..0000000 Binary files a/assets/UML_dark.png and /dev/null differ diff --git a/assets/UML_light.png b/assets/UML_light.png deleted file mode 100644 index ecd57e4..0000000 Binary files a/assets/UML_light.png and /dev/null differ