| | Houdini 1.5a 32 bit codes exposed >> get it here | |
| | Author | Message |
---|
Bettina Admin
Posts : 914 Reputation : 3742 Join date : 2009-11-27 Location : Bettina ( Sobel ? ) speakeasy 77>> Up All Night 77 >> Chelsea 77 >> little venice, maida vale 77 >> ???? Wendy D Green & Adnan Khashoggi know .... DO YOU ? £10,000.00 reward for information leading to me . but i am NOT here !
| Subject: Houdini 1.5a 32 bit codes exposed >> get it here Sun Apr 08, 2012 6:05 pm | |
| [You must be registered and logged in to see this link.]
Quocvuong82posts
in "evaluation.c" Note: Houdini 1.5 use 200 centipawns (Pawn Value = 200) PHP Code: static int MaterialValue(...) { Rook = 5 Pawns, Knight = 3 Pawns, Bishop = 3.1 Pawns, Queen = 9.5 Pawns, Bishop pair = 0.45 Pawns int v0 = 5*(POPCNTMAX15(wBitboardR) - POPCNTMAX15(bBitboardR)) + 3*(POPCNTMAX15(wBitboardN) - POPCNTMAX15(bBitboardN)); int result = 1900*(POPCNTMAX15(wBitboardQ) - POPCNTMAX15(bBitboardQ)) + 620*(POPCNTMAX15(wBitboardB) - POPCNTMAX15(bBitboardB)) + 200*(POPCNTMAX15(wBitboardP) - POPCNTMAX15(bBitboardP) + v0); Houdini 1.5a no use wEnumBL, wEnumBD..., is only wEnumB And check Bishop on Light squares or Dark squares: wBitboardB & Light... Light is Light squares = 0x55AA55AA55AA55AA if ((wBitboardB & Light) && (wBitboardB & Dark)) result += 90; if ((bBitboardB & Light) && (bBitboardB & Dark)) result -= 90; return result; }
- [You must be registered and logged in to see this link.] we post LOA'sH :D | [You must be registered and logged in to see this link.] | some iPPOLIT code from whoudunitome 1.5a [You must be registered and logged in to see this link.] Today 7:06 am static int ValueEndPawn(int sq) { int ValueOnFile[8] = {-4, -6, -8, -10, -10, -8, -6, -4}; int ValueOnRank[8] = {0, -3, -3, -2, -1, 0, 2, 0}; int rank = sq >> 3; //RankOf(sq); if (rank && rank != 7) return (ValueOnFile[sq & 7] + ValueOnRank[rank]); else return 0; } A copy of the IPPOLIT family
Quocvuong82 | [You must be registered and logged in to see this link.] | some more of same [You must be registered and logged in to see this link.] Today 7:08 am Static value: PHP Code: static int ValueOpenPawn(int sq) { int ValueOnFile[8] = {-20, -8, -2, 5, 5, -2, -8, -20}; int ValueOnRank[8] = {0, -3, -2, -1, 1, 2, 3, 0}; int rank = sq >> 3; //RankOf(sq); if (rank && rank != 7) return (ValueOnFile[sq & 7] + ValueOnRank[rank]); else return 0; } A copy of the IPPOLIT family
Quocvuong82 | [You must be registered and logged in to see this link.] | re: can we have our £&$'s back now ? [You must be registered and logged in to see this link.] Today 8:04 am PHP Code: static int ValueEndPawn(int sq) { int ValueOnFile[8] = {-4, -6, -8, -10, -10, -8, -6, -4}; int ValueOnRank[8] = {0, -3, -3, -2, -1, 0, 2, 0}; int rank = sq >> 3; RankOf(sq); if (rank && rank != 7) return (ValueOnFile[sq & 7] + ValueOnRank[rank]); else return 0; } A copy of the IPPOLIT family
PHP Code: static int ValueOpenKnight(int sq) { int ValueOnFile[8] = {-26, -10, 1, 5, 5, 1, -10, -26}; int ValueOnRank[8] = {-32, -10, 6, 15, 21, 19, 10, -11}; if (sq == A8 || sq == H8) A8 = 56, H8 = 63 return -120; return (ValueOnFile[sq & 7] + ValueOnRank[sq >> 3]); } A copy of the IPPOLIT family
Quocvuong82 | [You must be registered and logged in to see this link.] | begining to wander ,,,,what has been added to make it stronger ??? [You must be registered and logged in to see this link.] Today 8:54 am Houdini 1.5a (w32) code PHP Code: static ValueEndKnight(int sq) { int ValueOnDiag[8] = {2, 1, 0, -1, -2, -4, -7, -10}; int ValueOnFile[8] = {-4, -1, 2, 4, 4, 2, -1, -4}; int ValueOnRank[8] = {-10, -5, -2, 1, 3, 5, 2, -3};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; d = ValueOnFile[f] + ValueOnDiag[abs(f - r) + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]; //((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32) is abs(d) ? return ValueOnRank[r] + d; } A copy of the IPPOLIT family Quocvuong82 is online now Reply With Quote | [You must be registered and logged in to see this link.] | RH your becoming boring now ,,,do something original !!!!! [You must be registered and logged in to see this link.] Today 9:20 am PHP Code: static ValueEndKnight(int sq) { int ValueOnDiag[8] = {2, 1, 0, -1, -2, -4, -7, -10}; int ValueOnFile[8] = {-4, -1, 2, 4, 4, 2, -1, -4}; int ValueOnRank[8] = {-10, -5, -2, 1, 3, 5, 2, -3};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; d = ValueOnFile[f] + ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]; ((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32) is abs(d) ? return ValueOnRank[r] + d; }
Houdini 1.5a (w32) code PHP Code: static int ValueEndQueen(int sq) { int ValueOnDiag[8] = {1, 0, -1, -3, -4, -6, -8, -12}; int ValueOnROrF[8] = {-2, 0, 1, 2, 2, 1, 0, -2};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq);// f = sq & 7; sint64 d = f + r - 7; return (ValueOnROrF[r] + ValueOnROrF[f] + ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]); } A copy of the IPPOLIT family | [You must be registered and logged in to see this link.] | re: can we have our £&$'s back now ? [You must be registered and logged in to see this link.] Today 9:22 am PHP Code: static int ValueOpenQueen(int sq) { int ValueOnDiag[8] = {3, 2, 1, 0, -2, -4, -7, -10}; int ValueOnROrF[8] = {-2, 0, 1, 2, 2, 1, 0, -2};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; d = ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]; ((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32) is abs(d) ? return (ValueOnROrF[r] + ValueOnROrF[f] - 5*(r == R1) + d);R1 = 0 } A copy of the IPPOLIT family Last edited by Quocvuong82; Today at 12:13. | [You must be registered and logged in to see this link.] | re: can we have our £&$'s back now ? [You must be registered and logged in to see this link.] Today 5:17 pm Re: Houdini 1.5a (w32) code PHP Code: static ValueEndKnight(int sq) { int ValueOnDiag[8] = {2, 1, 0, -1, -2, -4, -7, -10}; int ValueOnFile[8] = {-4, -1, 2, 4, 4, 2, -1, -4}; int ValueOnRank[8] = {-10, -5, -2, 1, 3, 5, 2, -3};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; d = ValueOnFile[f] + ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]; ((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32) is abs(d) ? return ValueOnRank[r] + d;
~~ static int ValueOpenQueen(int sq) { int ValueOnDiag[8] = {3, 2, 1, 0, -2, -4, -7, -10}; int ValueOnROrF[8] = {-2, 0, 1, 2, 2, 1, 0, -2};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; d = ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]; ((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32) is abs(d) ? return (ValueOnROrF[r] + ValueOnROrF[f] - 5*(r == R1) + d);R1 = 0 }
~~
static int ValueEndQueen(int sq) { int ValueOnDiag[8] = {1, 0, -1, -3, -4, -6, -8, -12}; int ValueOnROrF[8] = {-2, 0, 1, 2, 2, 1, 0, -2};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq); f = sq & 7; sint64 d = f + r - 7; return (ValueOnROrF[r] + ValueOnROrF[f] + ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)]); }
- [You must be registered and logged in to see this link.]
PHP Code: static int ValueOpenKing(int un_use1, int un_use2, int sq) { int ValueOnFile[8] = {40, 45, 15, -5, -5, 15, 45, 40}; int ValueOnRank[8] = {4, 1, -2, -5, -10, -15, -25, -35}; return (ValueOnFile[sq & 7] + ValueOnRank[sq >> 3]);
~~
static int ValueEndKing(int sq) { int ValueOnDiag[8] = {2, 0, -2, -5, -8, -12, -20, -30}; int ValueOnFile[8] = {-15, 0, 10, 15, 15, 10, 0, -15}; int ValueOnRank[8] = {-30, -5, 0, 5, 10, 5, 0, -10};
int r = RankOf(sq); r = sq >> 3; int f = FileOf(sq);// f = sq & 7; sint64 d = f + r - 7; d = ValueOnFile[f] + ValueOnDiag[abs(f - r)] + ValueOnDiag[((uint32)(d >> 32))^((uint32)(d) - (uint32)(d >> 32)];
return (ValueOnRank[r] + d); }
- [You must be registered and logged in to see this link.]
ALL copy of the IPPOLIT family | [You must be registered and logged in to see this link.] | ValueOpenBishop, ValueEndBishop, ValueOpenRook, ValueEndRook similar IPPOLIT family but Houdini 1.5a calculate in InitStatic. [You must be registered and logged in to see this link.] Today 5:19 pm PHP Code: static int ValueOpenBishop(int sq) { int ValueOnRank[8] = {10, 5, 1, -3, -5, -7, -8, -12}; int ValueOnDiag[8] = {-5, 0, 0, 0, 0, 0, 0, 0}; int r = RankOf(sq); int f = FileOf(sq); sint64 d = r + f - 7; return (ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + ValueOnDiag[abs(r - f)] + ValueOnRank[r]); }
static int ValueEndBishop(int sq) { int ValueOnDiag[8] = {3, 2, 0, 0, -2, -2, -3, -3}; int r = RankOf(sq); int f = FileOf(sq); sint64 d = r + f - 7; return (ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + ValueOnDiag[abs(r - f)]); }
static int ValueOpenRook(int sq) { int ValueOnFile[8] = {-4, 0, 4, 8, 8, 4, 0, -4}; return ValueOnFile[sq & 7]; }
static int ValueEndRook(int sq) { int ValueOnRank[8] = {0, 0, 0, 0, 1, 1, 1, -2}; return ValueOnRank[sq >> 3];
- [You must be registered and logged in to see this link.]
Last edited by Quocvuong82; Today at 19:31. | [You must be registered and logged in to see this link.] | typedef [You must be registered and logged in to see this link.] Today 5:23 pm typedef PHP Code: typedef enum{ wEnumOcc, wEnumK, wEnumP, wEnumN, wEnumB, wEnumR, wEnumQ, wEnum_Unknown bEnumOcc, bEnumK, bEnumP, bEnumN, bEnumB, bEnumR, bEnumQ, bEnum_Unknown }EnumPieces; | [You must be registered and logged in to see this link.] | Global [You must be registered and logged in to see this link.] Today 5:24 pm Poece Static data sint32 PieceStaticValue[16][64]; Static Weight int Pawn_Static_Weight; =32 int Knight_Static_Weight; =32 int Bishop_Static_Weight; =32 int Rook_Static_Weight; =32 int Queen_Static_Weight; =32 int King_Static_Weight; =32 | [You must be registered and logged in to see this link.] | Static init [You must be registered and logged in to see this link.] Today 5:25 pm void InitStatic() { int OpenB_ValueOnRank[8] = {10, 5, 1, -3, -5, -7, -8, -12}; int OpenB_ValueOnDiag[8] = {-5, 0, 0, 0, 0, 0, 0, 0}; int EndB_ValueOnDiag[8] = {3, 2, 0, 0, -2, -2, -3, -3}; int OpenR_ValueOnFile[8] = {-4, 0, 4, 8, 8, 4, 0, -4}; int EndR_ValueOnRank[8] = {0, 0, 0, 0, 1, 1, 1, -2}; int sq, f, r; sint64 d; int ValueOpen, ValueEnd, Pair; sq = 63; do { Pawn ValueOpen = (2*Pawn_Static_Weight*ValueOpenPawn(sq)/32); Note that Static value multiplie by 2 ValueEnd = 2*Pawn_Static_Weight*ValueEndPawn(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumP][sq] = Pair; PieceStaticValue[bEnumP][H8 - sq] = - Pair;This is bug but no problem because PieceStaticValue[pi][H8] = PieceStaticValue[pi][A8], ...
Knight ValueOpen = (2*Knight_Static_Weight*ValueOpenKnight(sq)/32); ValueEnd = 2*Knight_Static_Weight*ValueEndKnight(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumN][sq] = Pair; PieceStaticValue[bEnumN][H8 - sq] = - Pair;
f = FileOf(sq); r = RankOf(sq); d = r + f - 7;
Bishop ValueOpen = OpenB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + OpenB_ValueOnDiag[abs(r - f)] + OpenB_ValueOnRank[r]; ValueOpen = (2*Bishop_Static_Weight*ValueOpen/32); ValueEnd = EndB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + EndB_ValueOnDiag[abs(r - f)] ValueEnd = (2*Bishop_Static_Weight*ValueEnd)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumB][sq] = Pair; PieceStaticValue[bEnumB][H8 - sq] = -Pair;
Rook ValueOpen = (2*Rook_Static_Weight*OpenR_ValueOnFile[sq & 7])/32; ValueEnd = (2*Rook_Static_Weight*EndR_ValueOnRank[sq >> 3])/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumR][sq] = Pair; PieceStaticValue[bEnumR][H8 - sq] = -Pair;
Queen ValueOpen = (2*Queen_Static_Weight*ValueOpenQueen(sq))/32; ValueEnd = (2*Queen_Static_Weight*ValueEndQueen(sq))/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumQ][sq] = Pair; PieceStaticValue[bEnumQ][H8 - sq] = - Pair;
King ValueOpen = (2*King_Static_Weight*ValueOpenKing(sq))/32; ValueEnd = 2*King_Static_Weight*ValueEndKing(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumK][sq] = Pair; PieceStaticValue[bEnumK][H8 - sq] = - Pair; --sq; } while (sq >= 0);
|
| |
| | | LondonFrau Admin
Posts : 1288 Reputation : 3534 Join date : 2010-02-27 Location : ???
| Subject: Re: Houdini 1.5a 32 bit codes exposed >> get it here Mon Apr 09, 2012 9:10 am | |
| | |
| | | Bettina Admin
Posts : 914 Reputation : 3742 Join date : 2009-11-27 Location : Bettina ( Sobel ? ) speakeasy 77>> Up All Night 77 >> Chelsea 77 >> little venice, maida vale 77 >> ???? Wendy D Green & Adnan Khashoggi know .... DO YOU ? £10,000.00 reward for information leading to me . but i am NOT here !
| Subject: Re: Houdini 1.5a 32 bit codes exposed >> get it here Wed Apr 11, 2012 12:38 am | |
| [You must be registered and logged in to see this link.]
| Global: [You must be registered and logged in to see this link.] Monday, 12:15 pm static const char ConfigHex[74] = "5D717974912A20202020202020202020202020202020202020202020202020202020202020"; static sint32 ConfigData[37]; | [You must be registered and logged in to see this link.] | And call InitParameter() on Engine Init [You must be registered and logged in to see this link.] Monday, 12:17 pm void InitParameter() { int Lo, Hi; int cnt; for (cnt = 0; cnt < 37; cnt++) { Hi = (int)(ConfigHex[2*cnt]); Lo = (int)(ConfigHex[2*cnt + 1]); if (Lo < 97) if (Lo < 65) Lo -= 48; else Lo -= 55; else Lo -= 87;
if (Hi < 97) if (Hi < 65) Hi -= 48; else Hi -= 55; else Hi -= 87; ConfigData[cnt] = Hi*16 + Lo;Convert Hex -> Dec, i.e "9A" -> 9*16 + 10 = 154 } ConfigData[] = {93, 113, 121, 116, 145, 42, 32, 32, 32, 32, ...} MaterialInit(); StaticInit(); PawnStructInit(); } | [You must be registered and logged in to see this link.] | Global [You must be registered and logged in to see this link.] Monday, 12:18 pm static sint32 PawnCP, KnightCP, BishopCP, RookCP, QueenCP, BishopPairCP; | [You must be registered and logged in to see this link.] | MaterialInit [You must be registered and logged in to see this link.] Monday, 7:29 pm
void MaterialInit() { PawnCP = ConfigData[0]; = 93 KnightCP = ConfigData[1] + 200; = 313 BishopCP = ConfigData[2] + 200; = 321 RookCP = ConfigData[3] + 375; = 491 QueenCP = ConfigData[4] + 850; = 995 BishopPairCP = ConfigData[5]; = 42; CalcMaterialValue(); for all table CalcDeltaMargins();Why call in Material Init? } | [You must be registered and logged in to see this link.] | EDITID by Quocvuong82 [You must be registered and logged in to see this link.] Monday, 7:35 pm Quote: Originally Posted by Quocvuong82 View Post
~~ typedef
typedef enum{ wEnumOcc, wEnumP, wEnumN, wEnumB, wEnumR, wEnumQ, wEnumK, wEnum_Unknown bEnumOcc, bEnumP, bEnumN, bEnumB, bEnumR, bEnumQ, bEnumK, bEnum_Unknown }EnumPieces;
Global
Piece Static data sint32 PieceStaticValue[16][64]; Init Static PHP Code: void InitStatic() { Static Weight int Pawn_Static_Weight = ConfigData[6]; =32 int Knight_Static_Weight = ConfigData[7]; =32 int Bishop_Static_Weight = ConfigData[8]; =32 int Rook_Static_Weight = ConfigData[9]; =32 int Queen_Static_Weight = ConfigData[10]; =32 int King_Static_Weight = ConfigData[11]; =32 Houdini use direct in the expression
int OpenB_ValueOnRank[8] = {10, 5, 1, -3, -5, -7, -8, -12}; int OpenB_ValueOnDiag[8] = {-5, 0, 0, 0, 0, 0, 0, 0}; int EndB_ValueOnDiag[8] = {3, 2, 0, 0, -2, -2, -3, -3}; int OpenR_ValueOnFile[8] = {-4, 0, 4, 8, 8, 4, 0, -4}; int EndR_ValueOnRank[8] = {0, 0, 0, 0, 1, 1, 1, -2}; int sq, f, r; sint64 d; int ValueOpen, ValueEnd, Pair; sq = 63; do { Pawn ValueOpen = (2*Pawn_Static_Weight*ValueOpenPawn(sq)/32); Note that Static value multiplie by 2 ValueEnd = 2*Pawn_Static_Weight*ValueEndPawn(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumP][sq] = Pair; PieceStaticValue[bEnumP][H8 - sq] = -Pair;This is bug but no problem because PieceStaticValue[pi][H8] = PieceStaticValue[pi][A8], ...
Knight ValueOpen = (2*Knight_Static_Weight*ValueOpenKnight(sq)/32); ValueEnd = 2*Knight_Static_Weight*ValueEndKnight(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumN][sq] = Pair; PieceStaticValue[bEnumN][H8 - sq] = -Pair;
f = FileOf(sq); r = RankOf(sq); d = r + f - 7;
Bishop ValueOpen = OpenB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + OpenB_ValueOnDiag[abs(r - f)] + OpenB_ValueOnRank[r]; ValueOpen = (2*Bishop_Static_Weight*ValueOpen/32); ValueEnd = EndB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + EndB_ValueOnDiag[abs(r - f)] ValueEnd = (2*Bishop_Static_Weight*ValueEnd)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumB][sq] = Pair; PieceStaticValue[bEnumB][H8 - sq] = -Pair;
Rook ValueOpen = (2*Rook_Static_Weight*OpenR_ValueOnFile[sq & 7])/32; ValueEnd = (2*Rook_Static_Weight*EndR_ValueOnRank[sq >> 3])/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumR][sq] = Pair; PieceStaticValue[bEnumR][H8 - sq] = -Pair;
Queen ValueOpen = (2*Queen_Static_Weight*ValueOpenQueen(sq))/32; ValueEnd = (2*Queen_Static_Weight*ValueEndQueen(sq))/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumQ][sq] = Pair; PieceStaticValue[bEnumQ][H8 - sq] = - Pair;
//King ValueOpen = (2*King_Static_Weight*ValueOpenKing(sq))/32; ValueEnd = 2*King_Static_Weight*ValueEndKing(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumK][sq] = Pair; PieceStaticValue[bEnumK][H8 - sq] = -Pair; --sq; } while (sq >= 0); | [You must be registered and logged in to see this link.] | EDITED typedef [You must be registered and logged in to see this link.] Monday, 7:37 pm Originally Posted by Quocvuong82 View Post typedef typedef enum{... ... PHP Code:
Edit:
typedef enum{ wEnumOcc, wEnumP, wEnumN, wEnumB, wEnumR, wEnumQ, wEnumK, wEnum_Unknown bEnumOcc, bEnumP, bEnumN, bEnumB, bEnumR, bEnumQ, bEnumK, bEnum_Unknown }EnumPieces;
Global | [You must be registered and logged in to see this link.] | Global EDITED [You must be registered and logged in to see this link.] Monday, 7:38 pm
Global
//Piece Static data sint32 PieceStaticValue[16][64]; | [You must be registered and logged in to see this link.] | Init Static EDITED [You must be registered and logged in to see this link.] Monday, 7:39 pm void InitStatic() { Static Weight int Pawn_Static_Weight = ConfigData[6]; =32 int Knight_Static_Weight = ConfigData[7]; =32 int Bishop_Static_Weight = ConfigData[8]; =32 int Rook_Static_Weight = ConfigData[9]; =32 int Queen_Static_Weight = ConfigData[10]; =32 int King_Static_Weight = ConfigData[11]; =32 Houdini use direct in the expression int OpenB_ValueOnRank[8] = {10, 5, 1, -3, -5, -7, -8, -12}; int OpenB_ValueOnDiag[8] = {-5, 0, 0, 0, 0, 0, 0, 0}; int EndB_ValueOnDiag[8] = {3, 2, 0, 0, -2, -2, -3, -3}; int OpenR_ValueOnFile[8] = {-4, 0, 4, 8, 8, 4, 0, -4}; int EndR_ValueOnRank[8] = {0, 0, 0, 0, 1, 1, 1, -2}; int sq, f, r; sint64 d; int ValueOpen, ValueEnd, Pair; sq = 63; do { Pawn ValueOpen = (2*Pawn_Static_Weight*ValueOpenPawn(sq)/32); Note that Static value multiplie by 2 ValueEnd = 2*Pawn_Static_Weight*ValueEndPawn(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumP][sq] = Pair; PieceStaticValue[bEnumP][H8 - sq] = -Pair;This is bug but no problem because PieceStaticValue[pi][H8] = PieceStaticValue[pi][A8], ...
Knight ValueOpen = (2*Knight_Static_Weight*ValueOpenKnight(sq)/32); ValueEnd = 2*Knight_Static_Weight*ValueEndKnight(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumN][sq] = Pair; PieceStaticValue[bEnumN][H8 - sq] = -Pair;
f = FileOf(sq); r = RankOf(sq); d = r + f - 7;
Bishop ValueOpen = OpenB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + OpenB_ValueOnDiag[abs(r - f)] + OpenB_ValueOnRank[r]; ValueOpen = (2*Bishop_Static_Weight*ValueOpen/32); ValueEnd = EndB_ValueOnDiag[((uint32)(d >> 32))^((uint32)(d)) - (uint32)(d >> 32)] + EndB_ValueOnDiag[abs(r - f)] ValueEnd = (2*Bishop_Static_Weight*ValueEnd)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumB][sq] = Pair; PieceStaticValue[bEnumB][H8 - sq] = -Pair;
Rook ValueOpen = (2*Rook_Static_Weight*OpenR_ValueOnFile[sq & 7])/32; ValueEnd = (2*Rook_Static_Weight*EndR_ValueOnRank[sq >> 3])/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumR][sq] = Pair; PieceStaticValue[bEnumR][H8 - sq] = -Pair;
Queen ValueOpen = (2*Queen_Static_Weight*ValueOpenQueen(sq))/32; ValueEnd = (2*Queen_Static_Weight*ValueEndQueen(sq))/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumQ][sq] = Pair; PieceStaticValue[bEnumQ][H8 - sq] = - Pair;
King ValueOpen = (2*King_Static_Weight*ValueOpenKing(sq))/32; ValueEnd = 2*King_Static_Weight*ValueEndKing(sq)/32; Pair = (ValueOpen << 16) + ValueEnd; PieceStaticValue[wEnumK][sq] = Pair; PieceStaticValue[bEnumK][H8 - sq] = -Pair; --sq; } while (sq >= 0); } | [You must be registered and logged in to see this link.] | maybe peter pan can contribute something to IPPOLIT wiki FOR A CHANGE [You must be registered and logged in to see this link.] Monday, 7:41 pm and correct any errors as we struggle to provide this | [You must be registered and logged in to see this link.] | Houdini Calculate Weight in material_value.c [You must be registered and logged in to see this link.] Yesterday 6:29 pm
static int CalcWeight(int wP, int wN, int wB, int wBD, int wBL, int wR, int wQ, int bP, int bN, int bB, int bBD, int bBL, int bR, int bQ) { int bPhase; int wPhase; int wValue; int bValue; int Weight; int bMinor;
bMinor = bB + bN; bPhase = bB + bN + 2 * (bR + 2 * bQ); wPhase = wB + wN + 2 * (wR + 2 * wQ); wValue = 5 * wR + 3 * (wB + wQ + wN + 2 * wQ); bValue = 5 * bR + 3 * (bB + bQ + bN + 2 * bQ); if ( wP ) { if ( wP != 1 ) return 10; if ( bPhase != 1 ) { if ( bPhase == 2 ) { if ( bR == 1 ) { if ( wPhase == 2 && wR == 1 ) { return 8; } } else { if ( !bR && wPhase == 2 ) { | [You must be registered and logged in to see this link.] | This is result test Weight calc with IvanHoe method and Houdini Method: [You must be registered and logged in to see this link.] Yesterday 6:31 pm Test IvanHoe weight and Houdini weight Key: 1732 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 0 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 2, Houdini Weight: 1 Key: 47808 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 1 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 3, Houdini Weight: 1 Key: 48388 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 1 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 2, Houdini Weight: 1 Key: 51853 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 0 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 51997 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 0 bBL: 1, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 52141 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 0 bBL: 0, bBD: 1 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 52273 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 0 bBL: 1, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 53581 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 1 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 53713 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 1 bBL: 1, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 53857 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 1 bBL: 0, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 55297 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 2 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 55441 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 2 bBL: 1, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 55585 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 1 bN: 2 bBL: 0, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 94464 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 2 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 3, Houdini Weight: 1 Key: 95044 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 2 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 2, Houdini Weight: 1 Key: 98509 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 0 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 98653 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 0 bBL: 1, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 98797 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 0 bBL: 0, bBD: 1 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 98929 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 0 bBL: 1, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 100237 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 1 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 100369 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 1 bBL: 1, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 100513 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 1 bBL: 0, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 101953 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 2 bN: 2 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 141120 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 3 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 3, Houdini Weight: 1 Key: 145165 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 3 bN: 0 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 145585 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 3 bN: 0 bBL: 1, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 147025 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 3 bN: 1 bBL: 1, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 147169 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 3 bN: 1 bBL: 0, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 148609 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 3 bN: 2 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 187776 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 4 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 3, Houdini Weight: 1 Key: 191821 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 4 bN: 0 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 193681 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 4 bN: 1 bBL: 1, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 193825 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 4 bN: 1 bBL: 0, bBD: 1 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 195265 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 4 bN: 2 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10 Key: 234432 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 5 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe Weight 3, Houdini Weight: 1 Key: 238477 (White: wP: 1 wN: 0 wBL: 0, wBD: 0 wR: 0 wQ: 1 - Black: bP: 5 bN: 0 bBL: 0, bBD: 0 bR: 1 bQ: 0) Ivanhoe Weight 5, Houdini Weight: 10
~
Comments: Key 1732 (KRKN) Ivanhoe weight 3, Houdini weight: 1 -> Houdini Key 47808 (KNNKP) Ivanhoe weight 3, Houdini weight: 1 -> Houdini Key 48388 (KNPKR) Ivanhoe weight 2, Houdini weight: 1 -> Houdini | [You must be registered and logged in to see this link.] | cont... [You must be registered and logged in to see this link.] Yesterday 6:32 pm Key 51853 (KQPKRP) Ivanhoe weight 5, Houdini weight: 10 -> Houdini Key 51997 (KRBPKQP) Ivanhoe weight 5, Houdini weight: 10 -> Houdini ? Key 52273 (KBBPKQP) Ivanhoe weight 5, Houdini weight: 10 -> Houdini Key 53581 (KRNPKQP) Ivanhoe weight 5, Houdini weight: 10 -> Houdini ? Key 53713 (KBNPKQP) Ivanhoe weight 5, Houdini weight: 10 -> Houdini | [You must be registered and logged in to see this link.] | cont [You must be registered and logged in to see this link.] Yesterday 10:05 pm static uint64 Make4(uint32 E, uint32 O, uint32 OM, uint32 ME, int Centipawns, int base) { uint64 result, rO, rOM, rME, rE; rO = (uint64)(2*O*Centipawns/base); rOM = ((uint64)(2*OM*Centipawns/base)) << 16; rME = ((uint64)(2*ME*Centipawns/base)) << 32; rE = ((uint64)(2*E*Centipawns/base)) << 48; return rO + rOM + rME + rE; } #define SWORD1(x) (*((short*)&(x)+1)) #define BYTE4(x) (*((char*)&(x)+4)) static int ExtractValue(uint64 v, int phase) { uint32 h; sint32 v1, v2, v3; h = (uint32)(v >> 32);
v1 = ((v & 0x8000u) != 0i64) + SWORD1(v); v2 = (v1 < 0) + (sint16)(h & 0xffff); if (phase > 8) { if (phase <= 24) { v3 = v1*(phase - 8) + v2*(24 - phase); return (sint32)(((BYTE4(v3) & 0xf) + (sint32)v3)/16); } return ((signed __int16)v * (phase - 24) + v1 * (32 - phasw))/8; } return (phase * v2 + (8 - phase) * ((v2 < 0) + SWORD1(h)))/8; } void MaterialInit() { int wP, wN, wB, wBL, wBD, wR, wQ; int bP, bN, bB, bBL, bBD, bR, bQ; int wMinor, bMinor; int phase; uint64 ValueQ, ValueR, ValueB, ValueN, ValueP; uint64 RookPawnAdjust, KnightPawnAdjust, DoubleRookPenalty, RookQueenPenalty, AdvantageMinorBonus; uint64 Value64; sint32 Value = 0; sint32 Weight; int MaterialOffset; ValueB = Make4(360, 280, 295, 325, BishopCP, 325); BishopCP = 321; ValueBP = Make4(55, 35, 40, 50, BishopPairCP, 50); Bishop Pair = 42; ValueP = Make4(125, 80, 90, 110, PawnCP, 100); PawnCP = 93; ValueR = Make4(610, 405, 450, 550, RookCP, 500); RookCP = 491; ValueN = Make4(355, 265, 280, 320, KnightCP, 325); KnightCP = 313; ValueQ = Make4(1150, 800, 875, 1025, QueenCP, 975); QueenCP = 995; RookPawnAdjust = Make4(0, 10, 8, 4, 1, 1); 0000-0004-0008-000A DoubleRookPenalty = Make4(64, 32, 40, 56, 1, 1); 0040-0038-0028-0020 RookQueenPenalty = Make4(32, 16, 20, 28, 1, 1); 0020-001C-0014-0010 AdvantageMinorBonus = Make4(10, 40, 30, 20, 1, 1); 000A-0014-001E-0028 KnightPawnAdjust = Make4(10, 0, 4, 8, 1, 1); 000A-0008-0004-0000 MaterialOffset = 0; bP = 0; while (1)bP = 0 -> 8 { | [You must be registered and logged in to see this link.] | cont.... [You must be registered and logged in to see this link.] Yesterday 10:06 pm wP = 0; while (1)wP = 0 -> 8 { bQ = 0; while (1)bQ = 0 - > 1 { wQ = 0; while (1)wQ = 0 -> 1 { bR = 0; while (1)bR = 0 -> 2 { bRQ = bR + bQ; wR = 0; while (1)wR = 0 -> 2 { bBD = 0; while (1)bBD = 0 - > 1 { wBD = 0; while (1)wBD = 0 -> 1 { bBL = 0; while (1)bBL = 0 -> 1 { bB = bBD + bBL; wBL = 0; while (1)wBL = 0 -> 1; { wB = wBD + wBL; bN = 0; while (1)bN = 0 -> 2 { bMinor = bB + bN; wN = 0; while (1) wN = 0 -> 2 { Calculator wMinor = wB + wN; phase = Value64 = (wP - bP)*ValueP + (wQ - bQ)*ValueQ + (wR - bR)*ValueR + (wB - bB)*ValueB + (wN - bN)*ValueN; Value64 += (wB / 2 - bB / 2)*ValueBP;
Next Houdini extract to Hi 32 bits and Lo 32 bits but I use 64 bit if (wR == 2) Value64 -= DoubleRookPenalty; if (bR == 2) Value64 += DoubleRookPenalty;
if (wR + wQ >= 2) Value -= RookQueenPenalty; if (bR + bQ >= 2) Value += RookQueenPenalty;
if (wMinor > bMinor) Value64 += AdvantageMinorBonus; if (bMinor > wMinor) Value64 -= AdvantageMinorBonus;
Value64 += RookPawnAdjust*(bR*(bP - 5) - wR*(wP - 5));
Value64 += KnightPawnAdjust*(wN*(wP - 5) - bN*(bP - 5));
phase = wMinor + bMinor + 3*(wR + bR) + 6*(wQ + bQ);
Value = ExtractValue(Value64, phase);
if (Value > 0) Weight = CalcWeight(wP, wN, wB, wBD, wBL, wR, wQ, bP, bN, bB, bBD, bBL, bR, bQ); else Weight = CalcWeight(bP, bN, bB, bBD, bBL, bR, bQ, wP, wN, wB, wBD, wBL, wR, wQ);
MaterialTable[MaterialOffset].Value = ((sint32)((uint64)(0x66666667ull * Value * Weight) >> 32) >> 2) + ((uint32)((uint64)(0x66666667ull * Value * Weight) >> 32) >> 31);why? CalcMaterialToken(MaterialOffset, wP, wN, wB, wBD, wBL, wR, wQ, bP, bN, bB, bBD, bBL, bR, bQ); ++wN; ++MaterialOffset; if (wN <= 2) continue; break; } ++bN; if (bN <= 2) continue; break; } ++wBL; if (wBL <= 1) { v = 0; continue; } break; } ++bBL; if (bBL <= 1) { v = 0; continue; } break; } ++wBD; if (wBD <= 1) { continue; } break; } ++bBD; if (bBD <= 1) { continue; } break; } ++wR; if ( wR <= 2 ) { continue; } break; } ++bR; if ( bR <= 2 ) { continue; } break; } ++wQ; if ( wQ <= 1 ) { continue; } break; } ++bQ; if (bQ <= 1) { continue; } break; } ++wP; if ( wP <= 8 ) { continue; } break; } ++bP; if (bP <= 8) { continue; } return; } } |
| |
| | | LondonFrau Admin
Posts : 1288 Reputation : 3534 Join date : 2010-02-27 Location : ???
| Subject: Re: Houdini 1.5a 32 bit codes exposed >> get it here Wed Apr 11, 2012 11:41 pm | |
| [You must be registered and logged in to see this link.]
| why ? [You must be registered and logged in to see this link.] Yesterday 5:01 am
: Houdini 1.5a (w32) code Quote: Originally Posted by Quocvuong82 Post PHP Code:
MaterialTable[MaterialOffset].Value = ((sint32)((uint64)(0x66666667ull * Value * Weight) >> 32) >> 2) + ((uint32)((uint64)(0x66666667ull * Value * Weight) >> 32) >> 31); //why?
~~~~~~~~~~~~~~~~ figyo commented
Why? It is a common compiler optimization of division by 10. The compiler replaces (x / 10) with ((x * 0x66666667) >> 2) because multiplication is much faster than division.
If you are curious, you can read more details here: [You must be registered and logged in to see this link.]
The corrected line then looks like:
MaterialTable[MaterialOffset].Value = Value * Weight / 10;
figyo
~~~~~~~~~~~~~~~~~~~~~~~~~~
| [You must be registered and logged in to see this link.] | Global [You must be registered and logged in to see this link.] Yesterday 11:15 pm Global
PHP Code: typedef struct { sint16 Value; 0-1 uint8 token; 2 uint8 flag; 3 uint8 endgameID; 4 uint8 endgametype; 5 }typeMaterialEntry; 6 byte
typeMaterialEntry MaterialTable[419904]; | [You must be registered and logged in to see this link.] | Call when Material Init [You must be registered and logged in to see this link.] Yesterday 11:16 pm
void CalcMaterialToken(int MaterialOffset, int wP, int wN, int wB, int wBL, int wBD, int wR, int wQ, int bP, int bN, int bB, int bBL, int bBD, int bR, int bQ) { int wMenNonPawn, bMenNonPawn, wMinor, bMinor;
wMenNonPawn = wQ + wB + wN + wR; bMenNonPawn = bQ + bN + bB + bR; wMinor = wB + wN; bMinor = bN + bB;
MaterialTable[MaterialOffset].endgametype = 24;
if ( wMenNonPawn == 1 && bMenNonPawn == 1 ) { if ( wQ == 1 && bQ == 1 && wP + bP == 1 || wR == 1 && bR == 1 && wP + bP == 1 ) { MaterialTable[MaterialOffset].endgametype = 0; } else { if ( wQ == 1 && bR == 1 && !wP && bP == 1 ) MaterialTable[MaterialOffset].endgametype = 8; if ( bQ == 1 && wR == 1 ) { if ( !bP && wP == 1 ) MaterialTable[MaterialOffset].endgametype = 8; }
if ( wB + wN == 1 && bMinor == 1 && bP + wP == 1 ) { MaterialTable[MaterialOffset].endgametype = 8; } } }
if ( !(bMenNonPawn + wMenNonPawn) ) { if ( (wP == 2 && bP == 1) || (wP == 1 && bP == 2)) MaterialTable[MaterialOffset].endgametype = 8; }
if ( (wMenNonPawn == 2 && wN == 2 && !wP && !bMenNonPawn && bP == 1) || (bMenNonPawn == 2 && bN == 2 && !bP && !wMenNonPawn && wP == 1) ) MaterialTable[MaterialOffset].endgametype = 8;
MaterialTable[MaterialOffset].token = 0x80; if ( wMenNonPawn == 1 && bMenNonPawn == 1 ) { if ( wQ == 1 && bQ == 1 ) { MaterialTable[MaterialOffset].token = Max(wP, bP) + 112; } if ( wR == 1 && bR == 1 ) { MaterialTable[MaterialOffset].token = 2 * (Max(wP, bP) + 48); } if ( wB == 1 && bB == 1 ) { if ( (wBL != 1 || bBD != 1) && (wBD != 1 || bBL != 1) ) { MaterialTable[MaterialOffset].token = 2 * (Max(wP, bP) + 60); } else { MaterialTable[MaterialOffset].token = 4 * (Max(wP, bP) + 12); } } if ( wN == 1 && bN == 1 ) { MaterialTable[MaterialOffset].token = Max(wP, bP) + 0x80; } } if ( !(wMenNonPawn + bMenNonPawn) ) { MaterialTable[MaterialOffset].token = 0xc0 - 8 * Max(wP, bP); } if ( !(bQ + bN + wQ + wN) && wB == 1 && bB == 1 && wR == 1 && bR == 1 && (wBL == 1 && bBD == 1 || wBD == 1 && bBL == 1) ) { MaterialTable[MaterialOffset].token = Max(wP, bP) + 112; }
MaterialTable[MaterialOffset].flag = ((wMenNonPawn > 0) << 1) | (bMenNonPawn > 0); if ( wMenNonPawn == 1 && wMinor == 1 && wP <= 4 && bP <= 4 ) MaterialTable[MaterialOffset].flag &= 0xFD; &=1
if ( bMenNonPawn == 1 && bMinor == 1 && wP <= 4 && bP <= 4 ) MaterialTable[MaterialOffset].flag &= 0xFEu; &=2
if ( wMenNonPawn == 1 && bMenNonPawn == 1 ) { if ( wQ == 1 && bQ == 1 ) MaterialTable[MaterialOffset].flag |= 4u; |= QUEEN_ENDING << 2 if ( wR == 1 && bR == 1 ) MaterialTable[MaterialOffset].flag |= 8u; |= ROOK_ENDING << 2 } if ( !wMenNonPawn ) MaterialTable[MaterialOffset].flag |= 0x80u; if ( !bMenNonPawn ) MaterialTable[MaterialOffset].flag |= 0x10u; if ( wMinor == 1 && wMenNonPawn == 1 ) MaterialTable[MaterialOffset].flag |= 0x20u; if ( bMinor == 1 && bMenNonPawn == 1 ) MaterialTable[MaterialOffset].flag |= 0x40u;
MaterialTable[MaterialOffset].endgameID = 0; if ( !(bQ + bR + bP + wQ + wP + wR) && wMenNonPawn <= 1 && bMenNonPawn <= 1 ) MaterialTable[MaterialOffset].endgameID = 5;
if ( !wMenNonPawn && wP == 1 && bP + bMenNonPawn == 1 && bB == 1 ) MaterialTable[MaterialOffset].endgameID = 14; if ( !bMenNonPawn && bP == 1 && wMenNonPawn + wP == 1 && wB == 1 ) MaterialTable[MaterialOffset].endgameID = 14;
if ( !wMenNonPawn && wP == 2 && bP + bMenNonPawn == 1 && bB == 1) MaterialTable[MaterialOffset].endgameID = 17;
if ( !bMenNonPawn && bP == 2 && wMenNonPawn + wP == 1 && wB == 1 ) MaterialTable[MaterialOffset].endgameID = 17;
if ( wMenNonPawn == 1 && bMenNonPawn == 1 ) { if ( ((wBL == 1 && bBL == 1) || (wBD == 1 && bBD == 1)) && (wP + bP == 1) ) MaterialTable[MaterialOffset].endgameID = 15;
if ( wBL == 1 && bBD == 1 || wBD == 1 && (bBL == 1) ) { if ( wP == 1 && bP <= 1 || bP == 1 && wP <= 1 ) MaterialTable[MaterialOffset].endgameID = 16; } if ( (wBL == 1 && bBD == 1 || wBD == 1 && bBL == 1) && (wP == 2 && bP <= 2 || bP == 2 && wP <= 2) ) MaterialTable[MaterialOffset].endgameID = 18; if ( wR == 1 && bB == 1 && wP == 1 && !bP || bR == 1 && wB == 1 && bP == 1 && !wP ) MaterialTable[MaterialOffset].endgameID = 19; }
if ( wMenNonPawn + wP == 1 && wQ == 1 && !bMenNonPawn && bP == 1 ) { MaterialTable[MaterialOffset].flag &= 0xFEu; MaterialTable[MaterialOffset].endgameID = 13; } if ( bP + bMenNonPawn == 1 ) { if ( bQ == 1 ) { if ( !wMenNonPawn && wP == 1 ) { MaterialTable[MaterialOffset].flag &= 0xFDu; MaterialTable[MaterialOffset].endgameID = 13; } } } if ( (wMenNonPawn + wP) == 1 && wQ == 1 ) { if ( bMenNonPawn == 1 && bR == 1 && bP <= 2 ) { MaterialTable[MaterialOffset].flag &= 0xFEu; MaterialTable[MaterialOffset].endgameID = 11; } } if ( (bP + bMenNonPawn) == 1 && bQ == 1 && wMenNonPawn == 1 && wR == 1 && wP <= 2 ) { MaterialTable[MaterialOffset].flag &= 0xFDu; MaterialTable[MaterialOffset].endgameID = 12; } if ( (wMenNonPawn + wP) == 1 && wR == 1 && !bMenNonPawn && bP == 1 ) MaterialTable[MaterialOffset].endgameID = 9; if ( (bP + bMenNonPawn) != 1 || bR != 1 ) { if ( wMenNonPawn ) { if ( wN == 1 && wB == 1 && (wMenNonPawn + wP) == 2 && !(bP + bMenNonPawn) ) MaterialTable[MaterialOffset].endgameID = 6; if ( bN == 1 && bB == 1 && !(wMenNonPawn + wP) ) { if ( (bP + bMenNonPawn) == 2 ) MaterialTable[MaterialOffset].endgameID = 6; } return; } } else { if ( wMenNonPawn ) { if ( wN == 1 && wB == 1 && (wMenNonPawn + wP) == 2 && !(bP + bMenNonPawn) ) MaterialTable[MaterialOffset].endgameID = 6; if ( bN == 1 && bB == 1 && !(wMenNonPawn + wP) ) { if ( (bP + bMenNonPawn) == 2 ) MaterialTable[MaterialOffset].endgameID = 6; } return; } if ( wP == 1 ) MaterialTable[MaterialOffset].endgameID = 10; } if ( !bMenNonPawn ) { MaterialTable[MaterialOffset].endgameID = 8; if ( bP + wP == 1 ) MaterialTable[MaterialOffset].endgameID = 7; } if ( wN == 1 && wB == 1 && (wMenNonPawn + wP) == 2 && !(bP + bMenNonPawn) ) MaterialTable[MaterialOffset].endgameID = 6; if ( bN == 1 && bB == 1 && !(wMenNonPawn + wP) ) { if ( (bP + bMenNonPawn) == 2 ) MaterialTable[MaterialOffset].endgameID = 6; } }
//Change name CalcMaterialToken to CalcMaterialInfo | [You must be registered and logged in to see this link.] | Test Ivanhoe46a weight and Houdini weight [You must be registered and logged in to see this link.] 30 minutes ago
Key: 1732 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 0 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 2, Houdini Weight: 1 Key: 47808 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 1 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 3, Houdini Weight: 1 Key: 48388 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 1 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 2, Houdini Weight: 1 Key: 94464 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 2 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 3, Houdini Weight: 1 Key: 95044 (White: wP: 0 wN: 0 wBL: 0, wBD: 0 wR: 1 wQ: 0 - Black: bP: 2 bN: 1 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 2, Houdini Weight: 1 Key: 141120 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 3 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 3, Houdini Weight: 1 Key: 187776 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 4 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 3, Houdini Weight: 1 Key: 234432 (White: wP: 0 wN: 2 wBL: 0, wBD: 0 wR: 0 wQ: 0 - Black: bP: 5 bN: 0 bBL: 0, bBD: 0 bR: 0 bQ: 0) Ivanhoe46a Weight 3, Houdini Weight: 1 ~~~~
Quocvuong82
|
| |
| | | Angels77 Admin
Posts : 548 Reputation : 1719 Join date : 2009-11-24 Location : awaiting land
| Subject: Message from figyo (R.V.) to Quocvuong82 Thu Apr 12, 2012 3:10 am | |
| Message from figyo (R.V.) to Quocvuong82 [You must be registered and logged in to see this link.] just now If you are an IDA user, I would recommend to guesstimate the position structure at the least... 00000000 Pos struc ; (sizeof=0x1C0) 00000000 squares db 64 dup(?) ; enum Piece 00000040 list_index db 64 dup(?) 00000080 piece_list db ? 00000081 wn_list db 11 dup(?) 0000008C wb_list db 11 dup(?) 00000097 wr_list db 11 dup(?) 000000A2 wq_list db 10 dup(?) 000000AC bn_list db 11 dup(?) 000000B7 bb_list db 11 dup(?) 000000C2 br_list db 11 dup(?) 000000CD bq_list db 10 dup(?) 000000D7 db ? ; undefined 000000D8 db ? ; undefined 000000D9 db ? ; undefined 000000DA db ? ; undefined 000000DB db ? ; undefined 000000DC db ? ; undefined 000000DD db ? ; undefined 000000DE db ? ; undefined 000000DF db ? ; undefined 000000E0 w_occ dq ? 000000E8 w_king dq ? 000000F0 w_pawns dq ? 000000F8 w_knights dq ? 00000100 w_bishops dq ? 00000108 w_rooks dq ? 00000110 w_queens dq ? 00000118 b_occ dq ? 00000120 b_king dq ? 00000128 b_pawns dq ? 00000130 b_knights dq ? 00000138 b_bishops dq ? 00000140 b_rooks dq ? 00000148 b_queens dq ? 00000150 total_occ dq ? 00000158 w_king_sq db ? 00000159 b_king_sq db ? 0000015A stm db ? 0000015B db ? ; undefined 0000015C plycnt dd ? 00000160 thread_id dd ? 00000164 sstack dd ? ; offset 00000168 pawn_hash dd ? ; offset 0000016C db ? ; undefined 0000016D db ? ; undefined 0000016E db ? ; undefined 0000016F db ? ; undefined 00000170 nodes dq ? 00000178 null_nodes dq ? 00000180 tb_hits dq ? 00000188 padding db 56 dup(?) 000001C0 Pos ends another hint: PHP Code: 00000000 SearchStack struc ; (sizeof=0xF8) 00000000 hash_key dq ? 00000008 pawn_key dq ? 00000010 mtrl_key dd ? 00000014 psq_value dd ? 00000018 total_phase db ? 00000019 castle_rights db ? 0000001A ep_square db ? 0000001B delay_qs db ? 0000001C field_1C db ? 0000001D field_1D db ? 0000001E b_danger db ? 0000001F w_danger db ? 00000020 phase_by_side db 2 dup(?) 00000022 piece_cnt db ? 00000023 lazy dd ? 00000027 field_27 db ? 00000028 w_attacks dq ? 00000030 b_attacks dq ? 00000038 w_pins dq ? 00000040 b_pins dq ? 00000048 w_pinners db 64 dup(?) 00000088 b_pinners db 64 dup(?) 000000C8 eval dd ? 000000CC psnl dd ? 000000D0 w_king_danger dd ? 000000D4 b_king_danger dd ? 000000D8 w_king_chk dq ? 000000E0 b_king_chk dq ? 000000E8 killer_a dw ? 000000EA killer_b dw ? 000000EC curr_move dw ? 000000EE flags db ? 000000EF ply db ? 000000F0 pl_index db ? 000000F1 capture db ? 000000F2 rule50 db ? 000000F3 field_F3 db ? 000000F4 delay_probe db ? 000000F5 is_draw db ? 000000F6 reduction db ? 000000F7 exact db ? 000000F8 SearchStack ends | |
| | | Sponsored content
| Subject: Re: Houdini 1.5a 32 bit codes exposed >> get it here | |
| |
| | | | Houdini 1.5a 32 bit codes exposed >> get it here | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |