Material table "drawishness" in R3/IPPOLIT
Posted: Mon Jan 31, 2011 3:27 am
This seemed like a good thing to explicate.
Both R3 and IPPOLIT have a "token" in the material value/adjustment table that controls the "drawishness". The function for this in IvanHoe is "InitTokens" in the file material_value.c ("initSHKALA" in IPPOLIT.c, if you care).
Here are the IPPOLIT values (in hexadecimal):
The Rybka 3 method is a bit more complicated (and contains an error, I think). Here is a "spec" for it (I leave CW to implement it). In all cases, if the PAWN_CRITERION (below) is true, the result is 0x80. This is the only adjustment for the number of pawns.
The function to compute this appears in 64-bit Rybka 3 at 0x45fd80, though this function does much more that just compute "tokens" (and in general is a horrendous case-based mess), with the relevant part being a couple thousand lines below (search for "0x73," for instance). The material table itself gets loaded at 0x712410 (see the 0x312410 offset in the evaluation functions, for instance), with the relevant bytes for the tokens being the 2nd in groups of 4, but you'd still have to know how the table is indexed to be able to reconnoiter its contents (well, it's no real mystery -- IPPOLIT uses the same indexing!).
I like this example because it shows a typical case of how IPPOLIT uses "ideas" but the realisation has a number of differences. It should be noted that there is another test for "drawishness" (for instance, BN vs B with no pawns is a draw, RB vs R is hard to win) that is folded into the material table, and there is also another "drawishness" considered in the pawn evaluation code [see Appendix A.3.2 of the R3/IPPOLIT report].
Both R3 and IPPOLIT have a "token" in the material value/adjustment table that controls the "drawishness". The function for this in IvanHoe is "InitTokens" in the file material_value.c ("initSHKALA" in IPPOLIT.c, if you care).
Here are the IPPOLIT values (in hexadecimal):
Base value 0x80 R and oppB 0x70 + MAX OppB ending 0x30 + 4 * MAX Knight ending 0x80 + MAX SameB ending 0x78 + 2 * MAX Rook ending 0x60 + 2 * MAX Queen ending 0x70 + MAX Pawn ending 0xc0 - 8 * MAX
The Rybka 3 method is a bit more complicated (and contains an error, I think). Here is a "spec" for it (I leave CW to implement it). In all cases, if the PAWN_CRITERION (below) is true, the result is 0x80. This is the only adjustment for the number of pawns.
Base value 0x80 OppB and knight 0x6c OppB and rook 0x66 OppB and queen 0x6c OppB unbalanced 0x73 [e.g. RB vs BN, bishops opp colours] OppB (and pawns) 0x39 Knight ending 0x88 Same B ending 0x8c Rook ending 0x80 Queen ending 0x73 Pawn ending 0xc0
The function to compute this appears in 64-bit Rybka 3 at 0x45fd80, though this function does much more that just compute "tokens" (and in general is a horrendous case-based mess), with the relevant part being a couple thousand lines below (search for "0x73," for instance). The material table itself gets loaded at 0x712410 (see the 0x312410 offset in the evaluation functions, for instance), with the relevant bytes for the tokens being the 2nd in groups of 4, but you'd still have to know how the table is indexed to be able to reconnoiter its contents (well, it's no real mystery -- IPPOLIT uses the same indexing!).
I like this example because it shows a typical case of how IPPOLIT uses "ideas" but the realisation has a number of differences. It should be noted that there is another test for "drawishness" (for instance, BN vs B with no pawns is a draw, RB vs R is hard to win) that is folded into the material table, and there is also another "drawishness" considered in the pawn evaluation code [see Appendix A.3.2 of the R3/IPPOLIT report].