TSCP

The EFS project

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

Demonstration

 

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.

 

Steps

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.2.0.3

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)

first_time++;

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] = {

A8,B8,C8,D8,E8,F8,G8,H8,

A7,B7,C7,D7,E7,F7,G7,H7,

A6,B6,C6,D6,E6,F6,G6,H6,

A5,B5,C5,D5,E5,F5,G5,H5,

A4,B4,C4,D4,E4,F4,G4,H4,

A3,B3,C3,D3,E3,F3,G3,H3,

A2,B2,C2,D2,E2,F2,G2,H2,

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; }

init();

evaluation();

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.

 

UPDATE

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

 

IMPORTANT

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

 

Download