chstan / Chess-Engine

A weak C language chess engine
5 stars 1 forks source link

Board Representation #1

Closed chstan closed 12 years ago

chstan commented 12 years ago

The board representation currently uses named fields for the bitboards. Changing this to an array index by the piece identifiers would reduce the amount of spaghetti code substantially.

chstan commented 12 years ago

I have changed the board representation to be much cleaner than it was before, some of the code in board.c needs to be updated still, but on the whole it is much more readable now. Unfortunately, the rules of chess maintain that some pieces have to be special cases, as in kings which have their own array in the board structure, and so conditionals still exist in the code.

chstan commented 12 years ago

The board representation should now properly track en passant moves, castling, and the fifty move stalemate rule. Still not tracked is the three move repetition rule. The code in board.c has been refactored to reflect these changes, and helpers were added in move.c which simplify making and unmaking moves on the new board representation.