Computer Chess Club Archives


Search

Terms

Messages

Subject: question about speed

Author: Uri Blass

Date: 08:28:51 04/19/03


Note that in this post I use for doing the post more readable

if (pawnmove||pawncapture) instead of
if  ((m.bits&16)||piece(m.to)==PAWN)



I have in movei the following code

if (pawnmove||pawncapture)
if (side==LIGHT)
undomovewhitepawndata(m);
else
undomoveblackpawndata(m);


The point is that
undomovewhitepawndata(m) and undomovewhitepawndata(m) has a common part and I
also have
if (pawnmove) or if (pawncapture) in these functions.

You can say that speed is not important becauase I can put the pawndata in the
hash tables but I am interested to know from speed point of view if there is a
better way because it can help me later in other decisions.

I do not like to check the condition pawnmove twice and this is exactly what I
do in the structure that I described.

I also think that it may be better to use one function undomovepawndata when
that function can call both undomovewhitepawn data and undomoveblackpawndata
based on the value of side so I can do the code smaller by not writing the
common part twice.

Uri



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.