Skip to content

Back-end of Kill the King, a web app that calculates forced checkmates in a chess position

License

Notifications You must be signed in to change notification settings

kael89/checkmate-finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chekmate Finder

Back-end of https://killtheking.netlify.app

Front-end repository: 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

Authors

Kostas Karvounis - kael89

License

This project is licensed under the GNU General Public License v3.0

About

Back-end of Kill the King, a web app that calculates forced checkmates in a chess position

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages