Virgo is a highly extensible and easy to use c++ header-only library for legal chess moves generation.
- Easy to integrate and use in any chess engine
- Bitboard representation paired with a fast lookup array
- Non-sliding attacks bitboards generated by fast lookup (Knights and King) and binary shift (Pawns)
- Sliding attacks bitboards generated from pre-computed Kindergartner bitboards
- Make-take move functions supplied with a simple Chessboard object
Download the repository and include Virgo's header into your source code. In order to include Virgo's implementation correctly, it is required to define the macro VIRGO_IMPLEMENTATION
before the #include
directory.
#define VIRGO_IMPLEMENTATION
#include "virgo.h"
#include <iostream>
int main() {
virgo::virgo_init();
std::vector<uint16_t> legal_moves = {};
virgo::Chessboard board = virgo::position_from_fen("n1n5/PPPk4/8/8/8/8/4Kppp/5N1N w - - 0 1");
std::cout << board << std::endl;
virgo::get_legal_moves<WHITE>(board, legal_moves);
for(uint16_t & move : legal_moves) {
std::cout << virgo::string::move_to_string(move) << std::endl;
}
std::cout << "\ntotal moves: " << legal_moves.size() << std::endl;
return 0;
}
- Magic bitboards lookup table
- Move representation size to 16bit
- Avoids illegal moves by design
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contribution you make to Virgo is greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Virgo is released under the under terms of the MIT License.