Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kael89/checkmate-finder
Back-end of Kill the King, a web app that calculates forced checkmates in a chess position
https://github.com/kael89/checkmate-finder
checkmate chess
Last synced: 4 days ago
JSON representation
Back-end of Kill the King, a web app that calculates forced checkmates in a chess position
- Host: GitHub
- URL: https://github.com/kael89/checkmate-finder
- Owner: kael89
- License: gpl-3.0
- Created: 2019-04-16T00:54:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T11:41:32.000Z (about 2 years ago)
- Last Synced: 2024-11-08T14:47:52.841Z (about 2 months ago)
- Topics: checkmate, chess
- Language: Java
- Homepage: https://killtheking.netlify.app/
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chekmate Finder
Back-end of https://killtheking.netlify.app
Front-end repository: [kill-the-king](https://github.com/kael89/kill-the-king)
## Installation
### Run the server locally
Prerequisites:
- Maven
```
mvn clean package
java -jar target\checkmatefinder-1.0-SNAPSHOT-jar-with-dependencies.jar
```The server should now be running at http://localhost:8080
## API Documentation
- Base path: `/api`
- Output structure: JSON object of `{ data: any, error: string }` schema### Type Definitions
| Name | Type | Info | Examples | Comments |
| ------------- | ------ | ----------------------------------------------------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| Color | Enum | Values: `'black'`\|`'white'` | `'black'` | |
| ChessTree | Object | Shape: `{[ [Position]: ChessTree[, [Position]: ChessTree[, ...]]] }` | `{}`, `{ A1-A2: {} }`, `{ D2-D4: { D7-D6: {}, D7-D5: {} } }` |
| ChessTreeType | Enum | Values: `'game'`\|`'forcedMate'` | `'forcedMate'` | |
| Move | String | Regex: `[A-H][1-8]-[A-H][1-8](=[B\|N\|Q\|R])?` | `'B2-E5'`,
`'D7-D8=Q'` | The part after `=` indicates pawn promotion: `B` => Bishop, `N` => Knight, `Q` => Queen, `R` => Rook |
| Piece | Object | Shape: `{ type: PieceType, color: Color, position: Position}` | `{ type: 'pawn', color: 'white', positon: 'B3' }` | |
| PieceType | Enum | Values: `'bishop'`\|`'king'`\|`'knight'`\|`'queen'`\|`'rook'`\|`'pawn'` | `'bishop'` | |
| Position | String | Regex: `[A-H][1-8]` | `'B3'` | |### API List
#### getTree
| Url | Method | Input | Output (`data`) | Description |
| --------------- | ------ | ------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------- |
| `/api/get-tree` | GET | Url query parameters, see table below | `ChessTree` | Returns a tree of chess moves, based on a specified board, starting player color and move depth |##### Input parameters
| Name | Type | Required | Example | Description |
| ------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | `ChessTreeType` | Yes | `game` | The type of chess tree to return:
- `game` returns all available moves for each player
- `forcedMate` returns starting player's moves that lead to forced mates in his favor, together with possible enemy responses |
| board | `Piece[]` | Yes | `[{ type: 'pawn', color: 'white', position: 'E2' }, {type: 'pawn', color: 'black', position: 'E7'}]` | The starting board |
| startingColor | Color | Yes | `black` | Determines which player plays first |
| depth | Integer | Yes | `4` | The number of moves for which the move tree will be created. Each player's move increases the depth by one |## Built with
- [Java 8](https://www.oracle.com/technetwork/java/javase/overview/java8-2100321.html)
- [Java Servlet](https://javaee.github.io/servlet-spec/)
- [Maven](https://maven.apache.org/)
- [JUnit 5](https://junit.org/junit5/)
- [Mockito](https://site.mockito.org/)
- [Jackson](https://github.com/FasterXML/jackson)
- [Apache Tomcat](https://tomcat.apache.org/)
- [AWS Lambda](https://docs.aws.amazon.com/lambda/index.html)## Authors
**Kostas Karvounis** - [kael89](https://github.com/kael89)
## License
This project is licensed under the GNU General Public License v3.0