Computer Chess Club Archives


Search

Terms

Messages

Subject: Question concering re-engineering chess-engine

Author: Daniel Clausen

Date: 15:18:23 05/29/01


Note: This posting contains stuff about chess-programming. So if you're not
interested in the programming part, you might want to skip that.

Hi

I've created my own chess engine but didn't work on it for about a year now.
Before I start to put in more stuff blindly (eval could really need work I guess
:) I'd like to re-engineer parts of it though. While I don't intend to change
the general approach I've taken so far (like being bitboard-based etc) I'd like
to change a few things which should help to make the engine a bit less
error-prone than it is at the moment.

Let me give you an example:

void generateWhiteCapMoves(board_t* b, int* nMoves, int move[]);

This function is supposed to fill the array pointed to by move[] with
pseudo-legal white capturing moves and store the number of produced moves in
nMoves.

While the current implementation should be bug-free such things are still rather
error-prone. Like the allocated array is not big enough etc. Now with a simple
list class I could change this to:

void generateWhiteCapMoves(const Board& b, List<int>& moveList);

And lines like

*move++ = pieceType | ((to+16)<<MOVE_FROM_OFFSET) | (to<<MOVE_TO_OFFSET);

could be change to something like moveList.addMove(pieceType, fromSq, toSq);

And instead of accessing the array with move[index] I would call
moveList.entry(index) where I would have the possibility to do some
bounds-checking and stuff.

Note that I don't intend to rewrite everything in C++ (or another OO-language)
and turn everything into a class. Just some things like turning int-arrays into
lists and similar stuff.

Now.. to my question... I've no idea what I have to expect speed-wise if I make
such changes. Maybe someone else did something similar in the past and wants to
share some experience? I'm expecting that the over-all speed would decrease with
10% maybe but that's just a wild guess. Did others do similar things with their
engines and would like to share their experience? :)

Opinions? Ideas? Shrieking epitaphs?

Regards,

Sargon



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.