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

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
Rebel
Posts: 4706
Joined: Thu Aug 18, 2011 10:04 am

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

Post by Rebel » Sun Jul 26, 2015 4:32 pm

ESF - (E)valuation (F)or (S)tarters is the C-code of the evaluation function of Mephisto Gideon (1993).

You can use the code in 2 ways:
1. build your own search around it.
2. insert it in your own existing engine.

Usuage
All it needs is the board in REBEL format as described below which you can communicate in 3 ways:

1. Use the REBEL format.
2. Make a quick conversion as demonstrated in TSCP (Tom Kerrigan Simple Chess Program), see example.
3. Use the EPD format, see the demonstration code in MAIN.CPP

....

http://rebel13.nl/efs/index.html

Ferdy
Posts: 4111
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

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

Post by Ferdy » Mon Jul 27, 2015 10:56 am

Very strong indeed than the original TSCP.

Code: Select all

   Engine         Score      Ts
1: Tscp_rebel_1.0 11.0/13 ······ 
2: Tscp1.81       2.0/13  2-11-0 

13 of 100 games played
Name of the tournament: TSCP-REBEL test
Site/ Country: Home, Philippines
Level: Tournament 40/3
Hardware: i7-2600K CPU @ 3.40GHz with 12 GB Memory
Operating system: Win 7 Prof SP 1 64 bit
Tried playing it.

[pgn]
[Event ""]
[Site "Home"]
[Date "2015.07.27"]
[Round "?"]
[White "Ferd"]
[Black "TSCP REBEL 1.0"]
[Result "1-0"]
[ECO "D20"]
[Opening "QGA"]
[Time "18:11:46"]
[Variation "3.e3 Nf6"]
[TimeControl "300+15"]
[Termination "normal"]
[PlyCount "119"]
[WhiteType "human"]
[BlackType "program"]

1. d4 d5 {-0.03/7 9} 2. c4 dxc4 {+0.17/7 10} 3. e3 Nf6 {+0.16/6 10} 4. Bxc4
Nbd7 {-0.16/6 10} 5. Nf3 e6 {-0.20/6 10} 6. O-O Nb6 {-0.16/6 10} 7. Bd3 c5
{-0.16/6 10} 8. Qc2 cxd4 {+0.02/6 11} 9. exd4 Bd7 {+0.09/6 11} 10. Bg5 Rc8
{+0.16/6 11} 11. Nc3 Bc6 {+0.11/6 11} 12. Qe2 Be7 {+0.03/6 11} 13. Rad1 h6
{0.00/6 11} 14. Bh4 g5 {+0.21/6 11} 15. Bg3 Nh5 {-0.12/6 11} 16. Be5 Nf6
{-0.21/6 11} 17. Ne1 Nbd5 {-0.07/6 12} 18. Nxd5 Bxd5 {-0.09/6 12} 19. f4
gxf4 {-0.11/6 12} 20. Rxf4 Kf8 {-0.33/6 12} 21. Qf2 Kg7 {-0.49/6 12} 22.
Nc2 Bxa2 {-2.25/6 12} 23. Rf1 Kg8 {-3.26/6 12} 24. Rxf6 Bxf6 {-4.74/7 12}
25. Bxf6 Qc7 {-5.74/7 12} 26. Qh4 Bc4 {-5.81/6 12} 27. Qg4+ Kf8 {-7.02/7
12} 28. Qg7+ Ke8 {-6.79/7 12} 29. Be5 Qe7 {-6.25/8 13} 30. Bxc4 Rxc4
{-6.24/7 13} 31. Qxh8+ Qf8 {-6.71/7 13} 32. Qxf8+ Kxf8 {-5.87/7 13} 33. Ne3
Rc6 {-5.95/7 13} 34. g4 Ra6 {-6.24/7 13} 35. h4 Ke7 {-6.12/7 13} 36. g5
hxg5 {-5.97/8 13} 37. hxg5 Rb6 {-6.09/7 13} 38. Rf2 Rc6 {-5.88/7 13} 39.
Rc2 Rxc2 {-5.74/9 13} 40. Nxc2 Kd7 {-5.71/8 13} 41. Kf2 b5 {-5.82/8 13} 42.
Ke2 a5 {-5.95/9 13} 43. Kd3 Kc6 {-6.03/9 13} 44. Ne3 Kd7 {-6.12/9 13} 45.
Ke4 Kd8 {-6.24/9 13} 46. d5 Kd7 {-6.45/8 13} 47. Kd4 b4 {-6.82/9 13} 48.
Kc4 exd5+ {-6.74/9 13} 49. Kxd5 a4 {-6.78/9 14} 50. Nc2 b3 {-7.23/10 14}
51. Na3 Ke8 {-7.23/9 14} 52. Kd6 Kf8 {-7.76/10 14} 53. Kd7 Kg8 {-8.28/10
14} 54. Ke7 Kh7 {-8.87/10 14} 55. Kf6 Kg8 {-M5/10 3} 56. Bd6 Kh8 {-M4/8 0}
57. Kxf7 Kh7 {-M3/6 0} 58. Bf8 Kh8 {-M2/4 0} 59. Bg7+ Kh7 {-M1/2} 60. g6#
1-0[/pgn]

Matthias Hartwich
Posts: 38
Joined: Tue Jul 01, 2008 7:36 pm

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

Post by Matthias Hartwich » Tue Jul 28, 2015 5:02 am

Thanks a lot!

So many gotos... :wink:

User avatar
Rebel
Posts: 4706
Joined: Thu Aug 18, 2011 10:04 am

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

Post by Rebel » Tue Jul 28, 2015 10:10 am

Matthias Hartwich wrote:Thanks a lot!

So many gotos... :wink:
I made (some) progress during the years :wink:

User avatar
Rebel
Posts: 4706
Joined: Thu Aug 18, 2011 10:04 am

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

Post by Rebel » Tue Jul 28, 2015 10:26 am

BTW, I tried (good old) Fruit, seem to work also. It's just that the NPS of FRED (FR)uit by (ED) is about 3 times slower. Perhaps something more need to be done. But you can try.

Add the following code to EVAL.CPP

Code: Select all

// eval()

#define REBEL	1

#if REBEL
#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"
#endif



int eval&#40;const board_t * board&#41; &#123;

#if REBEL

int fruit_square&#91;&#93; = &#123;
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, A1, B1, C1, D1, E1, F1, G1, H1, -1, -1, -1, -1,
-1, -1, -1, -1, A2, B2, C2, D2, E2, F2, G2, H2, -1, -1, -1, -1,
-1, -1, -1, -1, A3, B3, C3, D3, E3, F3, G3, H3, -1, -1, -1, -1,
-1, -1, -1, -1, A4, B4, C4, D4, E4, F4, G4, H4, -1, -1, -1, -1,
-1, -1, -1, -1, A5, B5, C5, D5, E5, F5, G5, H5, -1, -1, -1, -1,
-1, -1, -1, -1, A6, B6, C6, D6, E6, F6, G6, H6, -1, -1, -1, -1,
-1, -1, -1, -1, A7, B7, C7, D7, E7, F7, G7, H7, -1, -1, -1, -1,
-1, -1, -1, -1, A8, B8, C8, D8, E8, F8, G8, H8, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 &#125;;

int fruit_piece&#91;&#93; = &#123;
LL, -1, -1, -1, -1, WP, -1, -1, -1, -1, ZP, -1, -1, -1, -1, -1,
-1, WN, ZN, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, WL, ZL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, WT, ZT, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, WD, ZD, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, WK, ZK, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 &#125;;


	int x,y,z,s,p;
	kleur=0;					       // convert color to move
	if &#40;COLOUR_IS_BLACK&#40;board->turn&#41;) kleur=1;

	for &#40;x=0x44; x<=0xbb; x++) 
	 &#123; s=fruit_square&#91;x&#93;;			// convert square to REBEL format
	   if &#40;s<0&#41; continue;			// out of board
	   y=board->square&#91;x&#93;;
	   p=fruit_piece&#91;y&#93;;			 // convert piece_type to REBEL format
	   bord&#91;s&#93;=p; &#125;	

	init&#40;);
	evaluation&#40;); 
	return &#40;mp*100&#41;/256;	

	#endif
No goto's :lol: and with the #define REBEL you switch eval's.

Matthias Hartwich
Posts: 38
Joined: Tue Jul 01, 2008 7:36 pm

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

Post by Matthias Hartwich » Tue Jul 28, 2015 11:04 am

Looks great!

And because search is not directly affected, a match based on nodes would be fun.

Vinvin
Posts: 4377
Joined: Thu Mar 09, 2006 8:40 am
Full name: Vincent Lejeune

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

Post by Vinvin » Tue Jul 28, 2015 11:25 am

Rebel wrote:http://rebel13.nl/
I never saw this "rebel13" site, great exhibition of history ! 8-)

BeyondCritics
Posts: 346
Joined: Sat May 05, 2012 12:48 pm
Location: Bergheim

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

Post by BeyondCritics » Tue Jul 28, 2015 6:16 pm

Congratulations!

User avatar
Rebel
Posts: 4706
Joined: Thu Aug 18, 2011 10:04 am

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

Post by Rebel » Tue Jul 28, 2015 7:47 pm

Vinvin wrote:
Rebel wrote:http://rebel13.nl/
I never saw this "rebel13" site, great exhibition of history ! 8-)
Tx Vincent.

My provider recently switched webeditor software and by doing so made the template in use on top-5000.nl practically unusable, so I switch to a new and fresh domain. Was a fun experience, I never disliked HTML stuff.

User avatar
Rebel
Posts: 4706
Joined: Thu Aug 18, 2011 10:04 am

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

Post by Rebel » Fri Aug 21, 2015 9:58 am

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

http://rebel13.nl/efs/tscp.html

Post Reply