Welcome to the King's Board project, a Laravel-based project using API Platform to handle chessboard-related operations. This API allows retrieving and manipulating a chessboard structure, determining move validity, and assigning colors to board positions based on team and opponent pieces.
- Retrieve board colors: Get the current state of the chessboard with color-coded positions.
- Validate moves: Check if a given move is within the board limits.
- Assign colors dynamically: Colors are assigned based on opponent and team pieces.
- API Platform integration: Provides an OpenAPI-compatible documentation
git clone https://github.com/noweh/kingsboard.git .
cd projectcomposer installcp .env.example .env
php artisan key:generatephp artisan migratephp artisan serveEndpoint: POST /chessboard/retrieve_colors
{
"data": {
"view": "allies",
"pieces": [
{
"x": 0,
"y": 0,
"type": "rook",
"team": "allies"
},
{
"x": 0,
"y": 3,
"type": "queen",
"team": "allies"
},
{
"x": 6,
"y": 0,
"type": "pawn",
"team": "enemies"
},
{
"x": 7,
"y": 2,
"type": "bishop",
"team": "enemies"
},
{
"x": 7,
"y": 3,
"type": "queen",
"team": "enemies"
}
]
}
}{
"board": [
["green", "yellow", "red", ...],
[...]
]
}The API is documented using OpenAPI and can be accessed via:
http://localhost:8000/api/docs
Before implementing the full ChessBoard API, a lightweight PoC was created to validate the core mechanics. This minimal version consists of just a few lines of code and showcases how colors are dynamically assigned based on piece positions.
📌 You can check the initial PoC here