Skip to content
Snippets Groups Projects
user avatar
Clément Desberg authored
a17945a1

Chess

By Clément Desberg

Installation

To install BlueBubble, please type the following in a terminal :

cd target_directory
git remote add origin https://git.unistra.fr/desberg/chess.git
git branch -M main
git push -uf origin main

with target_directory being the directory where the project will be located.

Usage

Once the project is installed on your computer, you can use it by using the following command in a terminal while being in the project main directory :

./chess

Note that you can also do

src/echecs

Since this executable is the same, placed here for testing purposes

Documentation

Once Chess is installed, you can start to use it right away. However, if you want to read the documentation and understand how it work, just open the index.html file located in documentation/html/ If you need to recreate the documentation, install doxygen and then run in a terminal :

doxygen doxygen_config

Configuration

Chess is supposed to work as intended with only the provided configuration, however, if you wish to change its look, look for the config.h file in the system directory. When you change a parameter, don't forget to update the executable by typing in a terminal while in the main directory :

make chess

Here how to change its look :

First, the colors can be : terminal_black terminal_red terminal_green terminal_yellow terminal_blue terminal_magenta terminal_cyan terminal_white

  • BACKGROUND_COLOR1 Define the first background color. Used when printing the chess board as first color and as background for player print. Default value "terminal_white"

  • BACKGROUND_COLOR2 Define the second background color. Used when printing the chess board as second color. Default value "terminal_yellow"

  • PIECES_COLOR Define the pieces outline color, the black pieces color. Used when printing the pieces and as background for player print. Default value "terminal_black"

  • WARNING_TEXT_COLOR Define the color of check warning. Default value "terminal_red"

Main ideas in implementation

-The board is a class that contain all the chess board data and all methods to manipulate it, used in the main function present in

game.cc

-Coordinates are presented by a simple class containing two attributes, x and y. -Chess pieces are all classes that inherit from the generic piece class, and contain all data and methods relatable to pieces. Note that the pawn is special in that it has a different list of standard legal moves and "attack" moves (moves that result in the capture of an opponent's piece), and modify its standard legal moves list the first time it moves (to remove the possibilty to go foreward 2 cases). -Check state is detected by iterating over all opponents pieces and checking if capturing the king is a legal move. -Checkmate and pat are detecting by iterating over all possibles moves and finding if minimum one results in anything other than a check state.

Tests

Chess is provided with a dozen of test functions written in bash by my teacher that can test different aspects of the project, running the main executable with lot of different cases.

Support

As this project was limited in time, it will not be supported in the near future.