You can try playing by following the link.
To change the chess API provider, press the middle mouse button, no matter what part of the application you are in (main menu, game settings, the game itself).
Chess is a project that implements a well-known strategy game. You can play against your friend sitting next to you or against a bot. To determine where the bot should move, the project uses some APIs that perform game analysis.
The project uses the following technologies:
-
libraries
- SFML — for working with graphics (and its fork that supports compilation for the Web)
- C++ Requests — for sending HTTP requests
- JSON for Modern C++ — for serializing and deserializing data when saving a game or receiving game analysis from one of the chess APIs
-
chess APIs
-
tools for compilation and assembly
- CMake and Make — as a build system
- Emscripten — for building the project for the Web
The project was initially developed on Windows for Windows. Then the project underwent some refactoring, which was done on Linux. At the moment, the project can be built under Linux and Web.
To download the project, run the following commands:
git clone https://github.com/C0o1Pr0g3r/chess.gitTo build the project, you need to go to its root directory. To do this, run the following commands:
cd chessTo build the project, run the following commands:
cmake -B build
cmake --build buildSince SFML does not support compiling for the Web, this will require some manipulation compared to compiling for Linux, so you need to meet some prerequisites, namely:
- you must have Emscripten installed
- you must have the SFML library compiled for the Web
To install Emscripten, follow the official guide.
It is important to note that for Emscripten (emcmake, emmake and emrun programs) to work, you need to change the PATH and other environment variables in the current terminal. This is specified in the Emscripten installation instructions, so follow them if the commands given do not work.
To compile the SFML library for the Web, follow these instructions.
Download a fork of the SFML library that supports compilation for the Web:
git clone https://github.com/Zombieschannel/SFML.gitGo to the root directory of the library and switch to the desired branch:
cd SFML
git checkout SFML-3.x.x-EMCCBuild the library using the following commands:
emcmake cmake -B build
emmake make -C buildBring the library into a state ready for use with the following command:
cmake --install build --prefix=.It is important to note that in order for this project to find the SFML library compiled for the Web during build, the SFML library must be located next to this project's directory, i.e. at the same nesting level in the file system.
Once all prerequisites are met, the project can be built using the following commands (don't forget to change to the root directory of this project before running the following commands.):
emcmake cmake -B build
emmake make -C buildNote: the following commands must be run from the project root directory.
To run the project, run the following commands:
build/bin/ChessTo run the project, run the following commands:
emrun build/bin/Chess.html