Skip to content

danamira/chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFML Smart Chess Application

About

This is the second phase of my advanced programming class of the second semester of 2021-2022 academic year. A 'smart chess' application was needed to be written with the following functionalities:

  • The ability to play chess on the with the ordinary logics of chess.
  • The app must be able to report 'dangerous` moves to the player. These are the moves which allow the opponent to win the game in the next one/two moves.
  • The app also must be able to report the best attacks. These are the moves which enable the player to mate his opponent in the next one/two moves.
  • The app must be able to receive an chess board(in a certain text template) and provide all the above functionalities to the user.
  • A graphical user interface must be designed using the SFML library in order to let the user play the game in a graphical environment.

Implementation

This program simulates a real chess game through a graphical interface built by SFML library. It also finds the movies which make players vulnerable to mate-in-one or mate-in-two positions using a backtracking algorithm. In order to keep the visuals interesting, I mostly used images instead of SFML components as they provide more flexibility in terms of UI design.
Here is an screenshot from the application:

Screenshot from the app

In the above-demonstrated situation, white is possibly in a mate-in-one posiiton. However, the black has analyzed all the moves for the knight located in F8. The program suggests that out of the two possible moves for this piece, one of them enables the white to win the game in one move but one of them is not particularly dangerous. The dangerous move is marked with the alert icon.

Running the application

Simply clone this repository, switch directory to the root folder of the project and run g++ src/Main.cpp && ./a. Please note that you must have SFML installed in advance, it can be painlessly installed on most of the GNU/Linux distors by sudo apt install sfml.

About

A chess game with the ability to report dangerous moves. Written in C++.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published