Implement a chess library in C++ (No engine! No GUI!)

This project was successfully completed by NoPro for $600 USD in 14 days.

Get free quotes for a project like this
Project Budget
$250 - $750 USD
Completed In
14 days
Total Bids
Project Description


write a chess library ('classic chess' and 'Chess960') in C++ (No engine!! No GUI!), which is able to move and obey the rules!

(You don't have to be a chess expert, but you have to know the rules.)

In case that's not enough work for you:

In the next step I would like the library to 'speak' the typical chess protocols (UCI, XBoard, (F)ICS) and read/write PGN etc..

Maybe you want to do this also right now! Then just talk to me!

Use C++ (instead of C) for readability and abstraction! Not for showing how cool or memory- and time-consuming inheritance in C++ can be!

Implement moving rules (do and undo!), read/write FEN_string|X-FEN_string|Shredder-FEN_string and a few util functions using the two board representations NxN array and 'One dimensional board representation with border squares'. (Luckily I did that last one today to check if my dreams are working. I will show you...)

In the end I will be able to do something like this:

board = new board(num_of_files, num_of_ranks);

err=board.set_position_unknown(FEN_string|X-FEN_string|Shredder-FEN_string); // returns an error or on success the type of the fen-str




[url removed, login to view](); // trivial ASCII printout (for debugging)

err=board.set_move(&move_obj, figure_or_unknown, from_file_or_unknown, from_rank_or_unknown, to_file, to_rank, promotion_or_NONE, flag_to_test[NONE|CAPTURE|TEST|CHECK|MATE]);

// this can be done unlimited!



std::cout << board.get_fen_str(&fen_str) << "\n";

std::cout << board.get_xfen_str(&fen_str) << "\n";

std::cout << board.get_shredderfen_str(&fen_str) << "\n";


field_list= board.get_all_attacked_fields(WHITE|BLACK); // a list where the opponents king cannot go to!

if (board.is_mate()){ // NOT implemented by (length(board.get_all_legal_moves()) == 0)!!



if (board.is_stalemate()){ // NOT implemented by (length(board.get_all_legal_moves()) == 0)!!



delete board; // no EVERY allocated memory is gone!! Use valgrind to be sure!

How do I check if your implementation is correct?

1. You have to implement 'perft' ([url removed, login to view]) for a small check of the correctness of your move generator!

2. I have many games I just will try to replay them!

Because the library will later support other chess variants it is crucial to think about abstraction.

Some examples:

If a piece captures a piece of the opponent in 'classic chess' the captured piece is replaced by the capturing piece.

But in variant 'atomic' all other pieces of the opponent on the fields around the destination field will go away, too!

There are boards which do not use 8x8!

There are even boards which are a cylinder.

In variant bughouse chess a captured piece 'goes' to the board of the partner!

That sounds much more complicated than it actually is. (At least if you design the library carefully.)

No CamlCase! I like the '_'! Use C++11! No C++ Exceptions! (OK, my example code uses exception for tasks where it is really needed! I will show you...)

The code must be correct (e.g. no exits, asserts, etc) and must check and handle EVERY return code! Even from malloc/new!

The code must be documented by comments, meaningful function- and variable-names and by examples!!

If you really want the job, tell me more than 'I can do it'! Did you already have done similar work? etc.....

If you are one of the more interesting coders here I will show you the code I wrote the last 2 days so you are able to see how I like to program and what I mean with one dimensional array.

Do not use code of others! (No GNU, BSD etc....)

All rights of the code will be mine!

Completed by:

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online