Author: Eugene Nalimov
Date: 10:12:32 10/11/99
Go up one level in this thread
If you are using C++, you can do exactly the same by using templates. This way you don't have to artificialy separate your program into several files, nor you have to #define/#undef specialized code. Eugene On October 11, 1999 at 12:31:17, Bruce Moreland wrote: >On October 11, 1999 at 12:05:47, Antonio Dieguez wrote: > >>hello... >> >>I have a little and simple question... >>I do not know very much about the cache or things like that, but makes >>difference that more than 1 search function, for example one for each ply would >>be used, instead of only one in recursion? (in running speed, I know the >>difference in ilegibility) >> >>Many many thanks. > >Duplicating code like this can back-fire if the code gets so big it can't fit in >cache. If you are going to do this you may want to try it both ways to see if >you actually made an improvement. > >A way to do this without making it completely unreadable is to write the code >once and stick it in an include file, which is included several times, with >preprocessor directives that change the function name and whatever else changes >inside the function. I do this in a few cases where I want variations on the >same function, but don't want to have to change each of them when I want to >change common code. > >I also do this in my eval function to avoid having to have one piece of code >that evaluates white, and one that evaluates black. Others have had bugs >because they have two pieces of code and don't keep them doing the same thing, >or get a sign reversed when doing copy-paste. I don't have these problems >because I only write mine once, and I use preprocessor macros to handle the >differences between white and black. > >bruce
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.