The EFS project

(E)valuation (F)or (S)tarters



TSCP (Tom's Simple Chess Program) is one of the most easy to understand open source, highly recommended for starters. We will use the TSCP source code and implement the REBEL evaluation function of 1993 into it and see what happens.



1. Download TSCP from Tom's website.

2. Extract it into a folder.

3. Download and extract the REBEL evaluation source code into that folder.

4. Open the GNU compiler, create a project. Note: I am using Dev C++ version

5. Open the file eval.c and add the following to it:


#include <string.h>

#include <stdlib.h>

#include <stdio.h>

#include <conio.h>

#include "source/defines.c"

#include "source/tables.c"

#include "source/pst.c"

#include "source/vars.c"

#include "source/attack.c"

#include "source/eval1.c"

#include "source/eval2.c"

#include "source/init.c"

#include "source/quadrant.c"


6. Then we hack into int eval() and right after it insert the following code:


int x,s,p;


if (first_time==0) for (x=0; x<276; x++) bgboard[x]=bgstel[x]; // initialize board (once)


for (x=A1; x<=H8; x++) if (bord[x] > RR) bord[x]=LL; // clear board


char tscp_piece [] = { WP,WN,WL,WT,WD,WK,LL };


char tscp_square [64] = {








A1,B1,C1,D1,E1,F1,G1,H1 };


kleur=side; // convert color to move

for (x=0; x<=63; x++) // TSCP to REBEL

{ s=tscp_square[x]; // convert square to REBEL format

p=piece[x]; p=tscp_piece[p]; // convert piece_type to REBEL format

if (color[x]==1) p=p+6; // black piece

bord[s]=p; }



mp=(mp*100)/256; // convert back to TSCP score

return mp; // done


7. Compile.




A match on depth=5 shows an increase of about 200 elo points (75%), using depth=6 gives (80%), using time control 40/5 gives 79% even though TSCP's evaluation function is about twice as fast as REBEL. No further conclusions other than what was expected works. TSCP purely is a tutorial program and not a competitive one.



Tom has been so kind to give his permission to include the TSCP source code in the download on the next page. So you don't have to make any changes, just create a Project and compile. With the #define REBEL in EVAL.C you switch between the original TSCP and the one with the REBEL evaluation. Furthermore all (my) changes are commented with // @Ed



Please respect the wish of the author, you need Tom's permission to create a derivative work. The purpose of this page is for demonstration only.


Next Chapters