Giter Club home page Giter Club logo

chess-engine-gui's Introduction

Chess-Engine

A chess engine implemented with bitboards. This project is split into 2 sections. The backend / chess engine , which is compiled into a library. A frontend gui that links to the engine.

Bitboards

Bitboards are used to represent the board and its properties. The basic idea is that an 8x8 chess board can be represented by a 64 bit variable (in C/C++ that would be a long long unsigned int). If our architecture supports 64 bit registers this offers great computation speeds.

In this engine instead of using such long types an alias called "Bitboard" is used.

Fen strings

The board is initialized with a fen string provided as an argument. Fen strings describe a board state , whose turn it is , if en passant is available , castling rights , piece positions and half/full move counters. A fen string parser is implemented with proper error checking support.

Move generation

Pseudo moves are generated first. A pseudo move is a move that is legal in isolation but might not protect against a check or let the king be checked.

We differentiate between two piece categories. Leaper pieces and sliding pieces.

  • Leaper pieces : pawns , king , knights
  • Sliding pieces : queen , rook , bishop

Attack / move tables are pre-generated at startup. This way we can get all the possible pseudo moves for a given position without needing to calculate them on the fly.

Exception : pawn pushes are calculated on the spot due to their simplicity and strong correlation to the occupancy bitboards when calculating double pushes on the 2nd or 7th ranks.

A pseudo move is considered legal if after being applied it leaves no checks. This approach is possibly expensive since we have to copy the board for each pseudo move so it can be further optimized.

Human player

A human player can make a move by :

  • Dragging a piece to a destination square.
  • Selecting a piece and a destination square.

Dependencies

SFML , neither the package or the dlls are included in this repo. Used : sfml-graphics sfml-audio sfml-window sfml-system

chess-engine-gui's People

Contributors

timospal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.