In Progress

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


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!

Skills: C Programming, C++ Programming, Game Design

See more: chess library, gui implemented, chess gui, what is in c programming, what is a variable in programming, what is an array in programming, what is a library in programming, what is a function in programming, what is abstraction in programming, what did you like least about your last job, variable in programming, two dimensional design, test games job, test code generator, std list c, std list, std library, something cool to print, programming tasks in c++, programming library, programming inheritance, programming games in c++, programming board game, programming abstraction, or in c programming

About the Employer:
( 17 reviews ) Germany

Project ID: #4513509