Page 1 of 1

Board Representation

PostPosted: 14 Jun 2006, 08:47
by Terry Bolo
Hi all, my apologies for my dumb question but i'm new to programming in general. I want to create a simple chess engine but i do not have the skill to do so as i'm learning c++ currently. All i want to do for now is find a way to represent the board. I have read Dr. Hyatt's page and decided to use 0X88 board representation but i'm still a little confuse.

For example i would define the board as
Code: Select all
int board[128]
Code: Select all
int piece_color_white = 1
Code: Select all
int piece_color_black = 0
Code: Select all
const int pawn = 100
Code: Select all
const int torret = 500
Code: Select all
const int night = 300
Code: Select all
const int bishop = 300
Code: Select all
const int Queen = 900
Code: Select all
const int king = 5000

Here's my problem and not sure what to do next. Can someone please give me some hints. Thanks

Re: Board Representation

PostPosted: 14 Jun 2006, 18:27
by Harald Lüßen
Terry Bolo wrote:Hi all, my apologies for my dumb question but i'm new to programming in general. I want to create a simple chess engine but i do not have the skill to do so as i'm learning c++ currently. All i want to do for now is find a way to represent the board. I have read Dr. Hyatt's page and decided to use 0X88 board representation but i'm still a little confuse.
...
Here's my problem and not sure what to do next. Can someone please give me some hints. Thanks


Learning C++ _and_ chess programming is not a good idea.
Either you will do it very C++ like and end up with a strange
chess program or you will write a reasonable chess program
that looks like C and not C++. Chess in C++ can be done but
it is hard for a beginner.

Reading Bob's page alone is not enough. Find and read more
texts about chess programming, e.g.
http://www.brucemo.com/compchess/programming/

Here was a thread for chess programming beginners in a forum
at TalkChess.com:
http://216.25.93.108/forum/viewtopic.ph ... 586&t=3294
http://216.25.93.108/forum/viewtopic.ph ... 610&t=3294
http://216.25.93.108/forum/viewtopic.ph ... 166&t=3294
Perhaps these links work, I don't know.

In your code:
const int torret = 500; // torret is better known as rook.
int board[128]; // char board[128] ?
You have to decide but first you have to understand.
const int king = 5000; // Kings cannot be captured. Why a value?
And why piece values in centipawns for the board representation?
For pieces on board better use something like
1 = white pawn, 2 = white knight, ..., -1 or 7 = black pawn, ...

And regarding C++, where is a position class?

See, you just jumped in very cold water to learn swimming.
Have a warm welcome here. ;-)

Harald

Re: Board Representation

PostPosted: 14 Jun 2006, 22:04
by H.G.Muller

Re: Board Representation

PostPosted: 15 Jun 2006, 01:40
by Terry Bolo
Thanks for the links.