Skip to content

An Online/Offline playable Chess game with a smart AI on Qt5. It is wrote by C++.

Notifications You must be signed in to change notification settings

GavinJiacheng/Chess-Online_and_AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smart_Chess

A Chess game built by Qt and C++.
The game can be played online by creating games in the lobby.The server will show all games in the lobby available for all clients.
Playing offline is available with two modes: 1: Play against another human player; 2: Play against a very SMART AI.
The AI uses the MiniMax algorithm.
Some idea and information from this tutorial and https://github.com/subeshb1/Chess
AI's idea from https://github.com/lhartikk/simple-chess-ai
Click here to download and play HERE.

ALL code are in folder "Client" and "Server".

How to play online:

Alt text


VS2017 compiles the server. Qt creator compiles the client(Game).
Winsock and windows.h are used to write the online part. Currently no Linux support is available. There will be a Linux version in the future.
cJSON is used to serialize messages like the move, create games, games list, etc.
A TCP connection is sent to make sure it can receive and send the message successfully.

Here is another GIF how this game is played online: Alt text

Here is an example of what happen when one side wins in one game:

Alt text

How this AI is:

Alt text

I am not even its opponent!!!

The AI can play both of white side and black side:

Alt text

It was a simple version and looks very stupid: Alt text Alt text

This program can also play as PVP:

Alt text

Of course, it can do Promotion and Castling. Alt text

Alt text

Bugs:

There are currently many server-side bugs. Sometimes the messages will not be sent to clients.
There is a bug in AI when the AI only has two possible turns left.

Currently there a bugs in the code, I will be very appreciated if you can help me find the bugs! In addition, if you have any ideas which can help improve this game, please let me know!