Chess Game Oops Design Github
Chess Game
Chess Game as a show case for OOP design
Features:
- Undo move
- Load custom board config
- Possible moves highlighting
- Supports En Passant, Castling etc.
- Warning when king is under possible attack
Interface:
Design:
-
Design is aimed for high cohesion within module and low coupling between modules.
-
MVC architecture:
- Model: The chess board, chess rules, all the pieces. Under model directory.
- View: The chess board UI, window and control widgets. Under view directory.
- Controller: Bridges between model and view. Implemented in Controller.java.
-
OOP design patterns:
- Factory pattern: To construct chess pieces from their string representations. Later used for loading the board from a config file. Implementation is in BoardBuilder.java.
- Command pattern: Each move is encapsulated in a command, which has the logic to undo the move. Implementation is in Command.java.
- Observer pattern: Observers observe the status of the game such as checkmate or stalemate. Interface in GameObserverCallBacks.java.
Build and Run:
- Requires JRE and JDK version 1.8+
- Build jar: (in root directory)
chmod +x gradlew # Disable step by step manual test when building export SKIP_GUI=True ./gradlew build
The resulting jar will be in build/libs/ directory.
-
Run Jar:
-
cdintobuild/libs/. - Run
java -jar chess-game-1.0-SNAPSHOT.jar - If needed, select custom board config in
File > Open config fileorCtrl-oonce game window is visible.
-
-
Run tests:
- If you want to skip manual tests, set the env variable
SKIP_GUI=True. - Execute:
- Follow instructions to perform manual tests.
- If you want to skip manual tests, set the env variable
Create Custom Board Config:
- Example board configs are: board.conf, board_with_jumper.conf, and board_with_squeen.conf
- The first two lines are board height and width respectively
- The third line is the board type. Currently only supports
StandardChessBoard. - The following lines each represents the config of a row. Each piece is comma separated. Piece representation follows format:
<piece name>_<piece side>.
Chess Game Oops Design Github
Source: https://github.com/zli117/Chess-Game
Posted by: dangeloancell1948.blogspot.com

0 Response to "Chess Game Oops Design Github"
Post a Comment