Chess Bin

Computer Chess Information and Resources

Chess Board Square

In this post I will discuss the chess board square representation.  Before we can discuss the chess board we need to model how each of the chess board squares will be represented on our board.

The chess board square will be declared as an internal struct.  I have found that small structs seem to perform better then small classes.  Also making objects internal or even better private, tends to increase performance.

internal struct Square

Each chess board square can contain a chess piece.

internal Piece Piece;

Each Board Square will also have the following copy constructor that will copy the chess piece from the copied chess board square or set the chess piece to null, signifying that the current square is empty.

internal Square(Piece piece)
    Piece = new Piece(piece);

That's it for this post, next time I will discuss Chess Board Representation.

If you want to get started on creating your own chess engine download my C# Chess Game Starter Kit.

Comments (2) -

  • pwnd

    4/20/2009 8:55:37 AM |

    im new to Programming and have just recently d/l Visual C# 2008 Express Edition, since i am very interested in building a chess engine, but frankly i dont have a clue what im doing

    i d/l your starter kit but it keeps giving me this:
    Error  1  Unable to find manifest signing certificate in the certificate store.  

    ps. im really glad i found ur article

  • aberent

    4/22/2009 10:32:23 AM |

    I have just updated the chess development kit to reflect source code in my posts.  I have also removed the certificate from the project so you don't get the error message anymore.

Comments are closed