IvanHoe 999952 beta
- kingliveson
- Posts: 1388
- Joined: Thu Jun 10, 2010 1:22 am
- Real Name: Franklin Titus
- Location: 28°32'1"N 81°22'33"W
Re: IvanHoe 999952 beta
Some Hash improvements, couple bug fixes, code cleanup/re-ordering, couple UCI additions, etc... IvanHoe development seems very much on the right path if you asked me. Still about 2% slower than 999954 though. More important, seems very stable. Will upload Linux/Windows binaries soon.
diff 999953 999952
diff 999953 999952
Code: Select all
Only in 999952: 50move.c
diff 999953/CHANGE_LOG 999952/CHANGE_LOG
90a91,101
> 999952 UCI_OPTIONS: STATIC_WEIGHTING MOBILITY_WEIGHTING
> Time options
> New 100 move fix
> stop in MultiPV fixed
> Fix Robbo_mossa with DTC metric, effects "mainline" and direct
> BLOCK.INDEX for RobboBases
> More UCI bug fixes with complianing
> EvalHash to UCI
> Fact: Too large is bad (cache)! 2mb with LARGE 3% above 16mb
> Upon no large: set SmallEvalHash (kb)
>
Only in 999952: IH-SMP.h
Only in 999952: IH-ZOG-MP.h
Only in 999952: IH-board.h
Only in 999952: IH-hash.h
Only in 999952: IH-move.h
Only in 999952: IH-win-linux.h
Only in 999952: MEM_HANDLER.c
diff 999953/Makefile 999952/Makefile
5c5
< VERSION = 999953
---
> VERSION = 999952a-Beta
30a31
> SLAB_MEMORY.c \
36a38,39
> 50move.c \
> MEM_HANDLER.c \
98a102,108
> IH-win-linux.h \
> IH-hash.h \
> IH-ZOG-MP.h \
> IH-SMP.h \
> IH-board.h \
> IH-move.h \
> SLAB_MEMORY.h \
158c168,169
< RobboBuild_OBJECTS = $(RobboBuild_SOURCES:.c=.o) arrays.o magic_mult.o
---
> RobboBuild_HACK = arrays.o magic_mult.o SLAB_MEMORY.o MEM_HANDLER.o
> RobboBuild_OBJECTS = $(RobboBuild_SOURCES:.c=.o) $(RobboBuild_HACK)
diff 999953/READ_THIS 999952/READ_THIS
54,58c54,64
< Full Size RobboSize Index Total PerCent
< 3s: 410382 37176+ 272 37448 9.1%
< 4s: 157440864 15885237+ 10780 15935813 10.1%
< 5s: 37429189056 3659510583+2289088 3661799671 9.8% (3.41GB)
< Zs: 5106866092 (4.76GB)
---
> 3s 4s 5s 4s+2s 3+3s
> Robbo 37176 15885237 3659510583 259583763053 216349730736
> Index 272 10780 2289088 12181784 9162036
> Total 37448 15896017 3661799671 259595944837 216358892772
> Block 9806 5474046 1423137391 241844059253 35541080878 <-- 5+1s
> Index 28 3004 868396 11324416 3019840
> Total 47282 21373067 5085805458 241855383669 35544100718 <-- 5+1s (33G)
> (46.2k) (15/20M) (3.4/4.74G) (242.8+225.2G) (201.5+33.1G)
>
> Regular 6s: 511498938327 (476.37G), 4+2 and 3+3: 475954837609 (443.27G)
> Total Count: 758461547803 (706.37G)
66,67c72,75
< For 6s, a superstructural indexing scheme is added for the future, and with
< some attempt for a compatability to the current to exist.
---
> The 6s use hyperindexing so they load fast at startup. The BLOCK_INDEX solves
> the nugget here also. The Nalimov are 1.2TB for 4+2 and 3+3 and we are nearly
> 3 times smaller. We verified the outliers against previous work except that
> the BlockedBases are totally new.
79c87
< until a later release.
---
> until a later release....
82c90
< are needed to extend the method.
---
> are needed to extend the method. The latest idea is to Huffman the RLE...
108,113c116,122
< 0 746764
< 1 1134276
< 2 9133
< 3 306
< 4 1818
< 5 55
---
> Broken: 746764
> Win: 1134276
> Draw: 9133
> Loss in 0: 306
> Loss in 1: 1818
> Loss in 2: 55
> Total 1892352
115d123
< Interpretation is 0: broke, 1: won, 2: drawn, 3+x: lost in x
117c125,127
< system conventions for endgames.
---
> system conventions for endgames. There is also a --zugzwang option to denote
> where the move is a burden.....
>
diff 999953/RobboLito.h 999952/RobboLito.h
5a6
> #define boolean uint8
7,8c8,54
< #define MULTIPLE_POS_GAIN FALSE
< #define MULTIPLE_HISTORY TRUE
---
> #if 1
> #define MAGIC_BITBOARDS
> #define ZUGZWANG_DETECT
> #define ONE_DIMENSIONAL
> #define SLAB_MEMORY /* 1% slower w/o LARGE_PAGES, 2% faster with LARGE_PAGES */
> #endif
>
> #define MULTIPLE_POS_GAIN
> #define MULTIPLE_HISTORY
>
> #ifdef SLAB_MEMORY
> #ifndef ONE_DIMENSIONAL
> #error SLAB_MEMORY requires ONE_DIMENSIONAL
> #endif
> #define SLAB_DECLARE1(Type, v, c) Type v[c]
> #define SLAB_ALLOC1(Type, v, c) /* */
> #define SLAB_DECLARE2(Type, v, c) Type *v
> #define SLAB_ALLOC2(Type, v, c) v = FromSlab ((c) * sizeof (Type))
> #define SLAB_DECLARE3 SLAB_DECLARE1 /* vis SLAB_DECLARE2 */
> #define SLAB_ALLOC3 SLAB_ALLOC1 /* vis SLAB_ALLOC2 */
> #else
> #define SLAB_DECLARE1(Type, v, c) Type v[c]
> #define SLAB_ALLOC1(Type, v, c) /* */
> #define SLAB_DECLARE2(Type, v, c) Type v[c]
> #define SLAB_ALLOC2(Type, v, c) /* */
> #define SLAB_DECLARE3 SLAB_DECLARE1
> #define SLAB_ALLOC3 SLAB_ALLOC1
> #endif
>
> #ifdef ZUGZWANG_DETECT
> #define ZUGZWANG_DETECT_DECLARE uint64 WZUG = 0, BZUG = 0;
> #define ZUGZWANG_DETECT_FACT_WHITE WZUG |= A & ~wBitboardOcc;
> #define ZUGZWANG_DETECT_FACT_BLACK BZUG |= A & ~bBitboardOcc;
> #if 0 /* too complicated? add pins if possible */
> #define ZUGZWANG_DETECT_COMPLETE \
> if (!(WZUG & ~POSITION->DYN->bAtt)) POSITION->DYN->flags &= ~2; \
> if (!(BZUG & ~POSITION->DYN->wAtt)) POSITION->DYN->flags &= ~1;
> #else /* simpler version */
> #define ZUGZWANG_DETECT_COMPLETE if (!WZUG) POSITION->DYN->flags &= ~2; \
> if (!BZUG) POSITION->DYN->flags &= ~1;
> #endif
> #else
> #define ZUGZWANG_DETECT_DECLARE /* */
> #define ZUGZWANG_DETECT_FACT_WHITE /* */
> #define ZUGZWANG_DETECT_FACT_BLACK /* */
> #define ZUGZWANG_DETECT_COMPLETE /* */
> #endif
14,102c60,61
< #if 1
< #define MAGIC_BITBOARDS TRUE
< #define ZUGZWANG_DETECT TRUE
< #endif
<
< #ifdef WINDOWS
< #include <windows.h>
< #define NOME_WINDOWS
< /* typedef ? */
< #define sint8 __int8
< #define sint16 __int16
< #define sint32 __int32
< #define sint64 __int64
< #define uint8 unsigned __int8
< #define uint16 unsigned __int16
< #define uint32 unsigned __int32
< #define uint64 unsigned __int64
< #define INLINE _inline
< #define atoll _atoi64
< #define TYPE_64_BIT "%I64d"
< #if 1
< #define MEMALIGN(a, b, c) a = _aligned_malloc (c, b)
< #define ALIGNED_FREE(x) _aligned_free (x)
< #else
< #define MEMALIGN(a, b, c) a = malloc (c)
< #define ALIGNED_FREE(x) free (x)
< #endif
< #define __builtin_prefetch /* */
< #ifdef WINDOWS_X64 /* 64 bits */
< #include "win64bits.h"
< #else
< #include "win32bits.h"
< #endif
< #define MUTEX_TYPE CRITICAL_SECTION
< #define COND_TYPE HANDLE
< #define LOCK(x) EnterCriticalSection (x)
< #define UNLOCK(x) LeaveCriticalSection (x)
< #define WAIT_CON_LOCK(x, y) WaitForSingleObject (x, INFINITE)
< #define SIGNAL_CON_LOCK(x, y) SetEvent (x)
< #define LOCK_INIT(x) InitializeCriticalSection (x)
< #define LOCK_DESTROY DeleteCriticalSection
< #define COND_INIT(x, y) (x) = CreateEvent (0, FALSE, FALSE, 0)
< #define TRY_LOCK(x) WaitForSingleObject (x, 0) /* HACK */
< #define PTHREAD_CREATE(N, b, thr, d) \
< (*(N)) = CreateThread (NULL, 0, thr, (LPVOID) (d), 0, NULL);
< #define PTHREAD_JOIN(x) \
< { DWORD w; do { GetExitCodeThread (x, &w); } while (w == STILL_ACTIVE); }
< HANDLE PTHREAD[MAX_CPUS], PTHREAD_IO;
< #define IVAN_THREAD(A) DWORD WINAPI ivan_thread (LPVOID A)
< #define IO_THREAD(A) DWORD WINAPI io_thread (LPVOID A)
< #define VOID_STAR_TYPE DWORD
<
< #else /* LINUX */
<
< #define sint8 signed char
< #define sint16 signed short int
< #define sint32 int
< #define sint64 long long int
< #define uint8 unsigned char
< #define uint16 unsigned short int
< #define uint32 unsigned int
< #define uint64 unsigned long long int
< #define INLINE inline
< #define TYPE_64_BIT "%lld"
< #define MEMALIGN(a, b, c) posix_memalign ((void*) &(a), b, c)
< #define ALIGNED_FREE(x) free (x)
< #include "bits.h"
< #include <pthread.h>
< #define MUTEX_TYPE pthread_mutex_t
< #define COND_TYPE pthread_cond_t
< #define LOCK(x) pthread_mutex_lock (x)
< #define UNLOCK(x) pthread_mutex_unlock (x)
< #define WAIT(x, y) pthread_cond_wait (x, y)
< #define SIGNAL(x) pthread_cond_signal (x)
< #define WAIT_CON_LOCK(x, y) { LOCK (&(y)); WAIT (&(x), &(y)); UNLOCK (&(y)); }
< #define SIGNAL_CON_LOCK(x, y) { LOCK (&(y)); SIGNAL (&(x)); UNLOCK (&(y)); }
< #define LOCK_INIT(x) pthread_mutex_init ((x), NULL)
< #define LOCK_DESTROY pthread_mutex_destroy /* new */
< #define TRY_LOCK(x) pthread_mutex_trylock (x)
< #define COND_INIT(x, y) \
< { pthread_cond_init (&(x), NULL); pthread_mutex_init (&(y), NULL); }
< #define PTHREAD_CREATE(N, b, thr, d) pthread_create (N, NULL, thr, (void*) (d))
< #define PTHREAD_JOIN(x) pthread_join (x, NULL)
< pthread_t PTHREAD[MAX_CPUS], PTHREAD_IO;
< #define IVAN_THREAD(A) void* ivan_thread (void* A)
< #define IO_THREAD(A) void* io_thread (void* A)
< #define VOID_STAR_TYPE void*
< #define LINUX_LARGE_PAGES TRUE /* NEW */ /* HACK */
< #endif
---
> #include "IH-win-linux.h"
> #include "IH-hash.h"
104,113d62
< MUTEX_TYPE PTHREAD_COND_MUTEX[MAX_CPUS], WAKEUP_LOCK_IO[1], SMP_IVAN[1];;
< COND_TYPE PTHREAD_COND_WAIT[MAX_CPUS], WAKEUP_IO[1];
< #define boolean uint8
< boolean volatile DIE[MAX_CPUS];
< boolean volatile SMP_HAS_AKTIV;
< boolean volatile IVAN_ALL_HALT;
< boolean volatile IO_AWAKE;
< boolean volatile INFINITE_LOOP;
< boolean volatile SEARCH_IS_DONE;
< boolean volatile STALL_MODE;
116,138c65,71
< int EASY_FACTOR, EASY_FACTOR_PONDER, BATTLE_FACTOR, ORDINARY_FACTOR,
< ABSOLUTE_PERCENT, DESIRED_MILLIS, BOOK_EXIT_MOVES;
< boolean EXTEND_IN_CHECK, TRY_LARGE_PAGES;
< int CURRENT_TOTAL_BASE_CACHE, CURRENT_HASH_SIZE;
<
< #define FILE(s) ((s) & 7)
< #define RANK(s) ((s) >> 3)
< #define FROM(s) (((s) >> 6) & 077)
< #define TO(s) ((s) & 077)
<
< /****************************************************************/
<
< typedef struct
< {
< uint64 volatile PAWN_HASH;
< uint8 wPfile_count, bPfile_count, OpenFileCount;
< boolean locked;
< uint32 wKdanger, bKdanger;
< uint8 wPlight, wPdark, bPlight, bPdark, wPassedFiles, bPassedFiles,
< wDrawWeight, bDrawWeight;
< uint32 SCORE;
< } typePawnEval; /* 32 bytes */
< typePawnEval *PawnHash;
---
> int EASY_FACTOR, EASY_FACTOR_PONDER, BATTLE_FACTOR, ORDINARY_FACTOR;
> int ABSOLUTE_PERCENT, DESIRED_MILLIS, BOOK_EXIT_MOVES;
> boolean TIME_IMITATE, TIME_LOSE_MORE, TIME_WIN_MORE;
> boolean TRY_LARGE_PAGES;
> boolean EXTEND_IN_CHECK; /* read much */
> int CURRENT_TOTAL_BASE_CACHE;
> uint64 NODE_CHECK; /* write in non-SMP */
142,356d74
< #define FLAG_LOWER 1
< #define FLAG_UPPER 2
< #define FLAG_CUT 4
< #define FLAG_ALL 8
< #define FLAG_EXACT 16
< #define FLAG_MOVE_LESS 32
< #define UPPER_FROM_PV 64
< #define LOWER_FROM_PV 128
<
< #define IsCUT(tr) ((tr->flags) & FLAG_CUT)
< #define IsALL(tr) ((tr->flags) & FLAG_ALL)
< #define IsExact(tr) ((tr)->flags & FLAG_EXACT)
<
< typedef struct
< {
< /* 00-03 */ uint32 hash;
< /* 04-07 */ uint8 flags, age, DepthUpper, DepthLower;
< /* 08-0b */ sint16 ValueLower, ValueUpper; /* overlap hash in lockless */
< /* 0c-0d */ uint16 move;
< /* 0e-0f */ uint8 rev, moveless;
< } typeHash;
<
< typeHash *HashTable;
< uint64 HashMask, AGE;
<
< #define HYPER_HASH /* for the novel! */
< #ifndef HYPER_HASH
< #define HASH_POINTER(x) (HashTable + ((x) & HashMask))
< #define HASH_POINTER0(x) (HashTable + ((x) & (3 + HashMask)))
< #else
< uint8 HASH_WHICH[16];
< typeHash* TABLE_ARR[3];
< uint64 MASK_ARR[3]; /* 64 bytes, but yet for the align? */
< #define HASH_POINTER(x) \
< (TABLE_ARR[HASH_WHICH[(x) >> 60]] + ((x) & MASK_ARR[HASH_WHICH[(x) >> 60]]))
< #define HASH_POINTER0(x) \
< (TABLE_ARR[HASH_WHICH[(x) >> 60]] + ((x) & (3 + MASK_ARR[HASH_WHICH[(x) >> 60]])))
< #endif
<
< #define NEW_HASH
< #ifdef NEW_HASH
< #define VAS(v) VALUE_ADJUST_STORE((v), (HEIGHT(POSITION)))
< #define HashLowerALL(POS, mv, dp, v) \
< HashLowerALLNew (POS->DYN->HASH, mv, dp, v, HEIGHT (POS))
< #define HashUpperCUT(POS, dp, v) \
< HashUpperCUTNew (POS->DYN->HASH, dp, v, HEIGHT (POS))
< #define HashLower(Z, mv, dp, v) \
< HashLowerNew (Z, mv, dp, v, 0, HEIGHT (POSITION))
< #define HashUpper(Z, dp, v) \
< HashUpperNew (Z, dp, v, 0, HEIGHT (POSITION))
< #define HashLowerPV(Z, mv, dp, v) \
< HashLowerNew (Z, mv, dp, v, LOWER_FROM_PV, HEIGHT (POSITION))
< #define HashUpperPV(Z, dp, v) \
< HashUpperNew (Z, dp, v, UPPER_FROM_PV, HEIGHT (POSITION))
< #define HashExact(POS, mv, dp, v, FL) \
< HashExactNew (POS->DYN->HASH, mv, dp, v, FL, HEIGHT (POSITION))
< #endif
<
< #if 0
< #define MATEING_SCORE /* Fact: slows by 1-2%: for the why? */
< #endif
< #ifdef MATEING_SCORE
< #if 1 /* ASM code */
< static INLINE sint32 VALUE_ADJUST_STORE(sint32 v, uint32 ht)
< {
< #ifdef WINDOWS /* for the workings? */
< int t1 = 0, t2 = 0;
< __asm
< {
< cmpl v, 29000
< cmovg t1, ht
< cmpl v, -29000
< cmovl t2, ht
< add v, t1
< sub v, t2
< }
< return v;
< #else /* for Workers */
< #if 0
< asm ("xor %%r10d,%%r10d\n"
< "cmpl $29000,%0\n"
< "cmovg %1,%%r10d\n"
< "xor %%r11d,%%r11d\n"
< "cmpl $-29000,%0\n"
< "cmovl %1,%%r11d\n"
< "add %%r10d,%0\n"
< "sub %%r11d,%0\n" :
< "=r" (v) :
< "r" (ht), "0" (v) :
< "%r11", "%r10");
< #else /* 32-bit */
< asm ("xor %%esi,%%esi\n"
< "cmpl $29000,%0\n"
< "cmovg %1,%%esi\n"
< "xor %%ebp,%%ebp\n"
< "cmpl $-29000,%0\n"
< "cmovl %1,%%ebp\n"
< "add %%esi,%0\n"
< "sub %%ebp,%0\n" :
< "=r" (v) :
< "r" (ht), "0" (v) :
< "%esi", "%ebp"); /* "cc" ? */
< #endif
< return v;
< #endif
< }
< #define HashUpperBound(tr) \
< VALUE_ADJUST_STORE (tr->ValueUpper, -HEIGHT(POSITION))
< #define HashLowerBound(tr) \
< VALUE_ADJUST_STORE (tr->ValueLower, -HEIGHT(POSITION))
< #define HashUpperValue(tr) (tr->ValueUpper)
< #define HashLowerValue(tr) (tr->ValueLower)
< static INLINE sint32 HashSwitchBound(sint32 Va, sint32 VA, uint32 ht)
< {
< #ifdef WINDOWS /* for the workings? */
< int t1 = Va + VA, t2 = 0;
< __asm
< {
< cmpl t1, 58000
< cmovg t2, ht
< sub Va, t2
< xor t2, t2
< cmpl t1, -58000
< cmovg t2, ht
< add Va, t2
< }
< return Va;
< #else /* for Workers */
< int t1 = Va + VA;
< asm ("xor %%esi,%%esi\n"
< "cmpl $58000,%1\n"
< "cmovg %2,%%esi\n"
< "sub %%esi,%0\n"
< "xor %%esi,%%esi\n"
< "cmpl $-58000,%1\n"
< "cmovl %2,%%esi\n"
< "sub %%esi,%0\n" :
< "=r" (Va) :
< "r" (t1), "r" (ht), "0" (Va) :
< "%esi"); /* "cc" ? */
< return Va;
< #endif
< }
< #define HashReBound(Va, VA) Va = HashSwitchBound (Va, VA, HEIGHT (POSITION));
< #else /* no asm codings, slow finds the snailery */
< #define VALUE_ADJUST_STORE(val, ht) \
< ((val) + (((val) > 29000) ? (ht) : 0) - (((val) < -29000) ? (ht) : 0))
< #define HashUpperBound(tr) \
< (tr->ValueUpper - ((tr->ValueUpper > 29000) ? (HEIGHT(POSITION)) : 0) \
< + ((tr->ValueUpper < -29000) ? (HEIGHT(POSITION)) : 0))
< #define HashLowerBound(tr) \
< (tr->ValueLower - ((tr->ValueLower > 29000) ? (HEIGHT(POSITION)) : 0) \
< + ((tr->ValueLower < -29000) ? (HEIGHT(POSITION)) : 0))
< #define HashUpperValue(tr) (tr->ValueUpper)
< #define HashLowerValue(tr) (tr->ValueLower)
< #define HashReBound(Va, VA) \
< { if (Va + VA > 29000 + 29000) Va -= HEIGHT (POSITION); \
< if (Va + VA < -29000 - 29000) Va += HEIGHT (POSITION); }
< #endif
< #else /* nein MATEING_SCORE */
< #define VALUE_ADJUST_STORE(Value, height) (Value)
< #define HashUpperValue(tr) (tr->ValueUpper)
< #define HashLowerValue(tr) (tr->ValueLower)
< #define HashUpperBound(tr) (tr->ValueUpper)
< #define HashLowerBound(tr) (tr->ValueLower)
< #define HashReBound(Va, VA) /* */
< #endif
<
< /********/ /********/ /********/ /********/ /********/ /********/ /********/
<
< /* YUSUF */
<
< boolean TITANIC_MODE;
< int volatile CPUS_SIZE;
< uint64 NODE_CHECK;
<
< #if 0 /* import the movdqu? */
< #define LOCKLESS_HASHING /* functional Yet: poored */
< #endif
< #ifdef LOCKLESS_HASHING /* Fact: 2-3% slowed, for the why? */
< #define TRANS_DECLARE() typeHash trans[1]
< #define YUSUF_DECLARE() typeHash *Trans
< #define TRANS_PV_DECLARE() typePVHash trans_pv[1]
< #define YUSUF_PV_DECLARE() typePVHash *Trans_pv
< #if 0 /* on/off */
< #define READ_WRITE_BARRIER() asm volatile ("" ::: "memory")
< #define HYATT_HASH(T, t) \
< { READ_WRITE_BARRIER(); \
< ((uint64*) (t))[0] = ((uint64*) (T))[0] ^ ((uint64*) (T))[1]; \
< ((uint64*) (t))[1] = ((uint64*) (T))[1]; READ_WRITE_BARRIER(); }
< #define HYATT_HASH_WRITE(t, T) \
< { READ_WRITE_BARRIER(); \
< ((uint64*) (T))[0] = ((uint64*) (t))[0] ^ ((uint64*) (t))[1]; \
< ((uint64*) (T))[1] = ((uint64*) (t))[1]; READ_WRITE_BARRIER(); }
< #else /* dummy */ /* Fact: 2-3% snailed in the already with the this */
< #define HYATT_HASH(T, t) { memcpy (t, T, 16); }
< #define HYATT_HASH_WRITE(T, t) { memcpy (t, T, 16); }
< #endif
< #define UPDATE_AGE() /* ? */ /* Need for the think */
< #else /* Personal Opinion: in the forget for the LOCKLESS_HASHING */
< #define Trans trans
< #define Trans_pv trans_pv
< #define TRANS_DECLARE() typeHash *trans
< #define YUSUF_DECLARE() /* */
< #define TRANS_PV_DECLARE() typePVHash *trans_pv
< #define YUSUF_PV_DECLARE() /* */
< #define HYATT_HASH(x, y) /* */
< #define HYATT_HASH_WRITE(x, y) /* */
< #if 1
< #define UPDATE_AGE() trans->age = AGE; /* purposeful? */
< #else
< #define UPDATE_AGE() /* */
< #endif
< #endif
<
360,372c78,81
< #define WHITE_IN_CHECK (POSITION->DYN->bAtt & wBitboardK)
< #define BLACK_IN_CHECK (POSITION->DYN->wAtt & bBitboardK)
< #define POS1 (POS0 + 1)
< #define MOVE_IS_CHECK_WHITE (POS1->wKcheck)
< #define MOVE_IS_CHECK_BLACK (POS1->bKcheck)
<
< #ifdef MULTIPLE_POS_GAIN
< sint16 MAX_POSITIONAL_GAIN[MAX_CPUS][0x10][010000];
< #define MAX_POS_GAIN(pez, mos) MAX_POSITIONAL_GAIN[POSITION->cpu][pez][mos]
< #else
< sint16 MAX_POSITIONAL_GAIN[0x10][010000]; /* multicore ? */
< #define MAX_POS_GAIN(pez, mos) MAX_POSITIONAL_GAIN[pez][mos]
< #endif
---
> #define HEIGHT(x) ((x)->height)
> #define IS_EXACT(x) (x) /* exact from RobboTriple */
>
> #include "IH-move.h"
378,379c87,88
< if (in_check && POSITION->DYN->reversible > 100) RETURN (0); \
< if (!in_check && POSITION->DYN->reversible >= 100) RETURN (0); \
---
> if (in_check && POSITION->DYN->reversible == 100) return Move50 (POSITION); \
> if (POSITION->DYN->reversible >= 100) RETURN (0); \
386,399d94
< uint64 hash;
< sint32 Value;
< uint16 move;
< uint8 depth, age;
< } typePVHash;
< typePVHash *PVHashTable; /* multicore ? */
< uint64 PVHashMask;
< sint64 PawnHashSize; /* uci option ahora */
<
< typedef struct { uint32 move; } typeMoveList;
< typedef struct { uint32 move; sint32 value; uint64 nodes; } typeRootMoveList;
<
< typedef struct
< {
411,607c106,109
< typedef struct
< {
< int phase, mask, bc;
< uint32 trans_move, move, exclude;
< uint64 TARGET;
< typeMoveList LIST[256];
< uint32 BAD_CAPS[64];
< } typeNEXT;
<
< #define HEIGHT(x) ((x)->height)
<
< typedef struct
< {
< int alpha;
< int beta;
< int depth;
< int node_type;
< int value;
< uint32 move;
< uint32 good_move;
< uint32 childs;
< typeNEXT* MOVE_PICK;
< boolean tot;
< boolean aktiv;
< MUTEX_TYPE splock[1];
< }
< SPLITPUNKT;
<
< SPLITPUNKT ROOT_SP[MAX_SP];
< volatile uint64 SMP_FREE;
< #define NODE_TYPE_PV 1
< #define NODE_TYPE_ALL 2
< #define NODE_TYPE_CUT 3
< #include <setjmp.h>
<
< #define MAX_STACK 256
< struct TP
< {
< uint8 sq[64];
< uint64 bitboard[16];
< #ifndef MAGIC_BITBOARDS
< uint64 OccupiedBW, OccupiedL90, OccupiedL45, OccupiedR45;
< #else
< uint64 OccupiedBW, _0, _1, _2;
< #endif
< uint8 XRAYw[64], XRAYb[64];
< uint8 wtm, wKsq, bKsq, height;
< /* Above bytes are copied, exactly 356 of them */
< /* 64 + 128 + 32 + 128 + 4 = 356 */
< typeDYNAMIC *DYN, *DYN_ROOT;
< uint64 STACK[MAX_STACK], StackHeight;
< uint64 nodes, tbhits;
< uint8 cpu, rp;
< boolean stop, used;
< MUTEX_TYPE padlock[1];
< int child_count;
< struct TP *parent, *children[MAX_CPUS];
< SPLITPUNKT *SplitPoint;
< };
<
< typedef struct TP typePOS;
< typePOS ROOT_POSITION[MAX_CPUS][RP_PER_CPU];
< typePOS ROOT_POSIZIONE0[1], NULL_PARENT[1];
<
< /***************************** ZOG MP *******************************/
<
< typedef struct {uint16 move; sint16 score;} type_ZOG_ML;
< struct ZN
< {
< typePOS POS[1]; /* STACK has 2048 bytes */
< MUTEX_TYPE lock[1];
< int alpha, beta, depth, orig_alpha, expected_value, best_value;
< struct ZN *PARENT;
< int USERS, AKTIV_MOVES_COUNT;
< int zm, phase;
< int ZOG_MOVE_COUNT, TOTAL_MOVE_COUNT, extension;
< boolean cpus_used[MAX_CPUS];
< struct ZN *children[MAX_CPUS];
< uint32 MOVE_FROM_PARENT, best_move;
< boolean is_busy, dead, EXPANDED, join_able, is_registered, is_book_keep;
< uint64 hash, when;
< int num, previous_result;
< type_ZOG_ML MOVE_LIST[256]; /* 1024 bytes */
< }; /* volatile? */
<
< boolean ZOG_AKTIV;
< uint64 ZOG_SIZE, ZOG_HEFT; /* int ? */
< boolean volatile ZOG_AVAILABLE;
< boolean volatile ZOG_AVAILABLE_OTHER;
< boolean volatile ZOG_ROOT_DONE;
< typedef struct ZN type_zog_node;
< #define MIN_ZOG_DEPTH 10
<
< /*********************************/ /*********************************/
<
< #define MAXIMUM_PLY 2048
< /* SMP rotogravure */
< #define WhiteOO (POSITION->DYN->oo & 0x1)
< #define WhiteOOO (POSITION->DYN->oo & 0x2)
< #define BlackOO (POSITION->DYN->oo & 0x4)
< #define BlackOOO (POSITION->DYN->oo & 0x8)
<
< typedef struct { sint16 Value; uint8 token, flags; } typeMATERIAL;
< typeMATERIAL MATERIAL[419904]; /* SMP read */
<
< typedef enum
< { wEnumOcc, wEnumP, wEnumN, wEnumK, wEnumBL, wEnumBD, wEnumR, wEnumQ,
< bEnumOcc, bEnumP, bEnumN, bEnumK, bEnumBL, bEnumBD, bEnumR, bEnumQ
< } EnumPieces;
< typedef enum
< { TRANS, CAPTURE_GEN, CAPTURE_MOVES,
< KILLER1, KILLER2, ORDINARY_MOVES, BAD_CAPS,
< TRANS2, CAPTURE_PGEN2, CAPTURE_MOVES2, QUIET_CHECKS, EVADE_PHASE, TRANS3,
< CAPTURE_GEN3, CAPTURE_MOVES3, QUIET_CHECKS3, POSITIONAL_GAIN_PHASE, FASE_0
< } EnumPhases;
< typedef enum
< { A1, B1, C1, D1, E1, F1, G1, H1, A2, B2, C2, D2, E2, F2, G2, H2,
< A3, B3, C3, D3, E3, F3, G3, H3, A4, B4, C4, D4, E4, F4, G4, H4,
< A5, B5, C5, D5, E5, F5, G5, H5, A6, B6, C6, D6, E6, F6, G6, H6,
< A7, B7, C7, D7, E7, F7, G7, H7, A8, B8, C8, D8, E8, F8, G8, H8
< } EnumSquares;
< typedef enum { R1, R2, R3, R4, R5, R6, R7, R8 } EnumRanks;
< typedef enum { FA, FB, FC, FD, FE, FF, FG, FH } EnumFiles;
<
< sint32 PieceSquareValue[0x10][0100]; /* SMP read */
<
< #ifdef MULTIPLE_HISTORY
< uint16 HISTORY[MAX_CPUS][0x10][0100]; /* SMP cashline ? */
< #define HISTORY_VALUE(P, M) HISTORY[P->cpu][P->sq[FROM (M)]][TO (M)]
< #else
< uint16 HISTORY[0x10][0100];
< #define HISTORY_VALUE(P, M) HISTORY[P->sq[FROM (M)]][TO (M)]
< #endif
<
< char STRING1[MAX_CPUS][64], STRING2[MAX_CPUS][64],
< STRING3[MAX_CPUS][64], STRING4[MAX_CPUS][64]; /* SMP */
<
< #define wBitboardK POSITION->bitboard[wEnumK]
< #define wBitboardQ POSITION->bitboard[wEnumQ]
< #define wBitboardR POSITION->bitboard[wEnumR]
< #define wBitboardBL POSITION->bitboard[wEnumBL]
< #define wBitboardBD POSITION->bitboard[wEnumBD]
< #define wBitboardB (wBitboardBL|wBitboardBD)
< #define wBitboardN POSITION->bitboard[wEnumN]
< #define wBitboardP POSITION->bitboard[wEnumP]
< #define wBitboardOcc POSITION->bitboard[wEnumOcc]
< #define bBitboardK POSITION->bitboard[bEnumK]
< #define bBitboardQ POSITION->bitboard[bEnumQ]
< #define bBitboardR POSITION->bitboard[bEnumR]
< #define bBitboardBL POSITION->bitboard[bEnumBL]
< #define bBitboardBD POSITION->bitboard[bEnumBD]
< #define bBitboardB (bBitboardBL|bBitboardBD)
< #define bBitboardN POSITION->bitboard[bEnumN]
< #define bBitboardP POSITION->bitboard[bEnumP]
< #define bBitboardOcc POSITION->bitboard[bEnumOcc]
<
< /******************************/ /******************************/
<
< #define ShiftLeft45 LineShift[Direction_h1a8]
< #define ShiftRight45 LineShift[Direction_a1h8]
< #define ShiftAttack LineShift[Direction_horz]
< #define ShiftLeft90 LineShift[Direction_vert]
< #define AttLeft45 LineMask[Direction_h1a8]
< #define AttRight45 LineMask[Direction_a1h8]
< #define AttNormal LineMask[Direction_horz]
< #define AttLeft90 LineMask[Direction_vert]
<
< #ifdef MAGIC_BITBOARDS
< typedef struct { uint64 mask, mult, shift; uint64* index; } type_MM;
< type_MM ROOK_MM[64], BISHOP_MM[64];
< uint64 MM_ORTHO[102400], MM_DIAG[5248];
< #define AttRocc(sq, OCC) ROOK_MM[sq].index\
< [((OCC & ROOK_MM[sq].mask) * ROOK_MM[sq].mult) >> ROOK_MM[sq].shift]
< #define AttBocc(sq, OCC) BISHOP_MM[sq].index\
< [((OCC & BISHOP_MM[sq].mask) * BISHOP_MM[sq].mult) >> BISHOP_MM[sq].shift]
< #define AttB(sq) AttBocc (sq, POSITION->OccupiedBW)
< #define AttR(sq) AttRocc (sq, POSITION->OccupiedBW)
< #define AttFile(sq) (AttR (sq) & FileArray[FILE (sq)])
<
< #else
<
< #define Att_h1a8(fr) \
< AttLeft45[fr][(POSITION->OccupiedL45 >> ShiftLeft45[fr]) & 077]
< #define Att_a1h8(fr) \
< AttRight45[fr][(POSITION->OccupiedR45 >> ShiftRight45[fr]) & 077]
< #define AttRank(fr) \
< AttNormal[fr][(POSITION->OccupiedBW >> ShiftAttack[fr]) & 077]
< #define AttFile(fr) \
< AttLeft90[fr][(POSITION->OccupiedL90 >> ShiftLeft90[fr]) & 077]
<
< #define AttB(fr) (Att_a1h8(fr) | Att_h1a8(fr))
< #define AttR(fr) (AttRank(fr) | AttFile(fr))
< #endif
<
< #define AttQ(fr) (AttR(fr) | AttB(fr))
<
< /******************************/ /******************************/
---
> #include "IH-SMP.h"
> #include "IH-board.h"
> #include "IH-ZOG-MP.h"
> #include "SLAB_MEMORY.h"
615,631d116
< #define FlagEP 030000
< #define FlagOO 010000
< #define FLAG_MASK 070000
< #define FlagPromQ 070000
< #define FlagPromR 060000
< #define FlagPromB 050000
< #define FlagPromN 040000
< #define MoveIsEP(x) (((x) & FLAG_MASK) == FlagEP)
< #define MoveIsProm(x) (((x) & FLAG_MASK) >= FlagPromN)
< #define MoveIsOO(x) (((x) & FLAG_MASK) == FlagOO)
< #define MoveHistory(x) (((x) & 060000) == 0)
<
< #define Direction_h1a8 0
< #define Direction_a1h8 1
< #define Direction_horz 2
< #define Direction_vert 3
< #define BAD_DIRECTION 37
634,644d118
< #define MOVE_NONE 0
<
< #ifdef USER_SPLIT
< boolean SPLIT_AT_CUT;
< int CUT_SPLIT_DEPTH, ALL_SPLIT_DEPTH, PV_SPLIT_DEPTH;
< #else
< #define SPLIT_AT_CUT TRUE
< #define CUT_SPLIT_DEPTH 16
< #define ALL_SPLIT_DEPTH 14
< #define PV_SPLIT_DEPTH 14
< #endif
652,659c126
< boolean DO_SEARCH_MOVES, SEND_CURR_MOVE, ROBBO_LOAD;
<
< uint32 SEARCH_MOVES[256];
<
< typedef struct
< { uint32 move; sint32 Value, alpha, beta; uint32 depth, _0; uint64 nodes; } typeMPV;
< typeMPV MPV[256];
< int MULTI_PV;
---
> boolean SEND_CURR_MOVE;
663c130,131
< boolean ALWAYS_ANALYZE, TRY_PV_IN_ANALYSIS, DEBUG_TIME_MANAGEMENT;
---
> boolean ALWAYS_ANALYZE, TRY_PV_IN_ANALYSIS, FIXED_AGE_ANALYSIS;
> boolean DEBUG_TIME_MANAGEMENT;
671a140
> int UCI_STATIC_WEIGHTING, UCI_MOBILITY_WEIGHTING; /* for the novel */
676d144
< char ROBBO_TRIPLE_DIR[1024], ROBBO_TOTAL_DIR[1024];
681a150,152
> char STRING1[MAX_CPUS][64], STRING2[MAX_CPUS][64],
> STRING3[MAX_CPUS][64], STRING4[MAX_CPUS][64]; /* SMP */
>
692,693d162
< #define IS_EXACT(x) (x) /* exact from RobboTriple */
<
726c195,196
< boolean USE_TOTAL_BASES_IN_SEARCH;
---
> char ROBBO_TRIPLE_DIR[1024], ROBBO_TOTAL_DIR[1024];
> boolean ROBBO_LOAD;
730d199
<
diff 999953/RobboTriple.c 999952/RobboTriple.c
207d206
<
diff 999953/RobboTripleBuild.c 999952/RobboTripleBuild.c
38c38
< { int j; for (j = 0; j < u; j++) fputc ( (a >> (8 * j)) & 255, file);}
---
> { int j; for (j = 0; j < u; j++) fputc ( (a >> (8 * j)) & 255, file); }
40a41
>
51,57c52,53
< #define fis(TH, w, MODO) \
< { int sq = w >> 2, king = w & 3; TH[sq] |= (MODO << (2 * king) ); w++; }
< #define fis2(TH, w, MODO) \
< { int sq = w >> 2, king = w & 3; TH[sq] |= (MODO << ( 2 * king ) ); w++; }
< #define ott(TH, i) (((TH[(i) >> 2]) >> (2 * ((i) & 3))) & 3)
< #define OTT(i) ch = POSITION->DYN[i++]; if ( (i % PR) == 0) ok = 0;
<
---
> #define SetVal(ARR, loc, v) { ARR[loc >> 2] |= (v << (2 * (loc & 3)) ); loc++; }
> #define GetVal(ARR, i) (((ARR[(i) >> 2]) >> (2 * ((i) & 3))) & 3)
59c55
< static void rle (char* b, int c, char* NOME, int* C)
---
> static void rle (char* b, int c, char* NOME, int* C) /* split this function */
149c145
< fis (b, c, 0);
---
> SetVal (b, c, 0);
151,152c147,148
< cu = ott (b, 0);
< for (i = 1; i <= c; i++)
---
> cu = GetVal (b, 0);
> for (i = 1; i <= c; i++) /* make run lengths */
154c150
< te = ott (b, i);
---
> te = GetVal (b, i);
161c157
< SPUT (r, cu);
---
> SPUT (r, cu); /* store run in L[l++] */ /* why a macro? */
166c162
< while (i < l)
---
> while (i < l) /* l as size of RLE encoded array */
168,169c164,165
< r = L[i] >> 2;
< ch = L[i] & 3;
---
> r = L[i] >> 2; /* length of run */ /* limit 2^29 ? */
> ch = L[i] & 3; /* value */
194c190
< && (w % PROP))
---
> && (w % PROP)) /* flip for run length 1 */
203c199
< BYTEw (r, ff, tr);
---
> BYTEw (r, ff, tr); /* encode byte into E array as E[w++] */
206c202
< if ((w % PROP) == 0)
---
> if ((w % PROP) == 0) /* demonstrate index on 64-byte boundary */
208c204
< I[Ii++] = (id << 2) + ch;
---
> I[Ii++] = (id << 2) + ch; /* index and value as 2 bits */
213c209
< for (i = w % PROP; i < PROP; i++)
---
> for (i = w % PROP; i < PROP; i++) /* fill as zeroes */
409c405
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
441c437
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
448c444
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
455c451
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
462c458
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
543c539
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
547c543
< && ott (TH, w - 1) != eVIT && ott (TH, w - 1) != vNON)
---
> && GetVal (TH, w - 1) != eVIT && GetVal (TH, w - 1) != vNON)
550c546
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
570c566
< fis2 (TH, w, MODO);
---
> SetVal (TH, w, MODO);
590c586
< while (ott (TH, i) == vNON)
---
> while (GetVal (TH, i) == vNON)
592c588
< s = ott (TH, i);
---
> s = GetVal (TH, i);
595c591
< fis2 (TH, j, s);
---
> SetVal (TH, j, s);
diff 999953/RobboTripleValue.c 999952/RobboTripleValue.c
12c12
< static int ott_data (uint8* E, int ba, uint8* AB, uint8* A, int PR, int sb)
---
> static int GetData (uint8* E, int ba, uint8* AB, uint8* A, int PR, int sb)
13a14,16
> /* GetData from 64-byte array E, or 16-byte if so */
> /* sb is starting WLD, AB is TripleBase->WLD_mapping and A the inverse */
> /* ba is the index we demand, PR is 64 or 16 as the limit */
16c19
< while (ba >= 0 && i < PR)
---
> while (ba >= 0 && i < PR) /* limit at 64 or when index decrements past 0 */
19,20c22,23
< tr = (ch & 64) >> 6;
< n = ch & 31;
---
> tr = (ch & 64) >> 6; /* caret for off result */
> n = ch & 31; /* run of size n unless larger */
22c25
< if (ch & 32)
---
> if (ch & 32) /* flip size one */
27c30
< ba--;
---
> ba--; /* size one */
30,31c33,34
< r = NX[r][tr];
< while (ch & 128)
---
> r = NX[r][tr]; /* update result */
> while (ch & 128) /* large run */
37c40
< ba -= n;
---
> ba -= n; /* size n */
42c45
< static int RobboTriple_valu (RobboTripleBase* TRIPLE_BASE, int i)
---
> static int RobboTriple_valu (RobboTripleBase* TRIPLE_BASE, int i) /* uint64? */
50c53
< else
---
> else /* find index in index heap, make use 64 bytes cache? */
64c67
< ott_data ((TRIPLE_BASE->data) + (TRIPLE_BASE->prop_ind * w),
---
> GetData ((TRIPLE_BASE->data) + (TRIPLE_BASE->prop_ind * w),
diff 999953/RobboTripleVerify.c 999952/RobboTripleVerify.c
212a213
> #ifndef MAGIC_BITBOARDS
224a226
> #endif
diff 999953/Robbo_build.c 999952/Robbo_build.c
156c156
< #define ZOBRIST(rf, PositionNumber) \
---
> #define ZOB_VAL(rf, PositionNumber) \
164c164
< int ok = ZOBRIST ((ip >> 32), (ip & 0xffffffff)), k = ok;
---
> int ok = ZOB_VAL ((ip >> 32), (ip & 0xffffffff)), k = ok;
199c199
< int k = ZOBRIST (rf, PositionNumber);
---
> int k = ZOB_VAL (rf, PositionNumber);
829,831c829,832
< void reindici (char *A); /* hiperindici */
< void stats (char *A); /* fail hiperindici compatible */
< void zugzwang (char *A);
---
> void reindici (char*); /* hiperindici */
> void stats (char*); /* fail hiperindici compatible */
> void zugzwang (char*);
> void MakeBlockIndex (char*);
841a843,847
> if (!strcmp (A[1], "--BlockIndex"))
> {
> MakeBlockIndex (A[2]);
> return;
> }
946a953,954
> sprintf (OTT, "%s/Z", TOTAL_BASE_DIRECTORY);
> GetTotalBase (OTT);
980a989,990
> sprintf (OTT, "%s/Z", TRIPLE_DIR);
> GetTripleBase (OTT);
1015a1026,1030
> void ResetHistory () {}
> void ResetPositionalGain() {}
> int InitMaterialValue() { return 0; }
> void InitStatic() {} /* HACK */
>
1023c1038,1039
< InitArrays ();
---
> TRY_LARGE_PAGES = FALSE;
> InitSlab (4);
1032a1049
> return 0;
diff 999953/Robbo_conto.c 999952/Robbo_conto.c
23,24c23,24
< (((pi == EnumOppP || pi == EnumOppK) ? AttK[king] : 0) | EVADE[king][sq]) &
< (~POSITION->OccupiedBW);
---
> (((pi == EnumOppP || pi == EnumOppK) ? AttK[king] : 0) |
> Evade (king, sq)) & (~POSITION->OccupiedBW);
36,38c36,38
< return POPCNT (flee &
< (((pi == EnumOppP || pi == EnumOppK) ? AttK[king] : 0) |
< EVADE[king][sq]));
---
> return
> POPCNT (flee & (((pi == EnumOppP || pi == EnumOppK) ? AttK[king] : 0) |
> Evade (king, sq)));
41c41
< ip = INTERPOSE[king][sq] & ~POSITION->OccupiedBW;
---
> ip = InterPose (king, sq) & ~POSITION->OccupiedBW;
85c85
< A &= INTERPOSE[MyKingSq][OppXrayTable[b]];
---
> A &= InterPose (MyKingSq, OppXrayTable[b]);
93c93
< A &= INTERPOSE[MyKingSq][OppXrayTable[b]];
---
> A &= InterPose (MyKingSq, OppXrayTable[b]);
101c101
< A &= INTERPOSE[MyKingSq][OppXrayTable[b]];
---
> A &= InterPose (MyKingSq, OppXrayTable[b]);
108,109c108
< BACK_SHIFT2 (empty) & (FileArray[FILE (MyKingSq)] |
< ~OppXRAY);
---
> BACK_SHIFT2 (empty) & (FileArray[FILE (MyKingSq)] | ~OppXRAY);
diff 999953/Robbo_extra.c 999952/Robbo_extra.c
6c6
< void reindici (char *A) /* hiperindici */
---
> void reindici (char *A) /* hiperindici */ /* obsolete */
131c131,227
< char* Name (int j, char* S)
---
> /**/ /**/ /****/ /********/ /****************/ /********/ /****/ /**/ /**/
>
> static void BlockIndexAdd (char* DIR, char* NOME, FILE* F)
> {
> char A[1024];
> FILE* iF;
> int i, num_indici;
> if (NOME[0] != 'i')
> return; /* not index */
> sprintf (A, "%s/%s", DIR, NOME);
> NOME += strlen ("iCOMP.");
> if (NOME[0] == 'K' || NOME[0] == 'k')
> un_windows (NOME);
> i = 0;
> while (NOME[i])
> i++;
> while (i <= 4)
> NOME[i++] = 0;
> fputc (0xee, F);
> fputc (0x63, F);
> fputc (0x70, F);
> fputc (0x41, F);
> fwrite (NOME, 1, 4, F);
> iF = fopen (A, "rb");
> fread (A, 1, 4, iF); /* mask */
> fread (A, 1, 4, iF); /* block size + compression */
> fwrite (A, 1, 4, F);
> fread (A, 1, 4, iF); /* empty */
> fread (A, 1, 4, iF); /* index counting */
> fwrite (A, 1, 4, F);
> for (i = 0; i < 4; i++)
> num_indici |= A[i] << (8 * i);
> for (i = 0; i < num_indici; i++)
> {
> fread (A, 1, 4, iF);
> fwrite (A, 1, 4, F);
> }
> fclose (iF);
> }
>
> #ifdef WINDOWS /* HACK */
> void MakeBlockIndex (char* A)
> {
> char B[1024], NOME[1024];
> WIN32_FIND_DATA ffd;
> HANDLE hFind = INVALID_HANDLE_VALUE;
> FILE* F;
>
> SEND ("info string Reading directory %s\n", A);
> strcpy (B, A);
> strcat (B, "\\*");
> hFind = FindFirstFile (B, &ffd);
> if (hFind == INVALID_HANDLE_VALUE)
> {
> SEND ("info string Directory %s not found\n", A);
> return;
> }
> sprintf (NOME, "%s/BLOCK.INDEX", A);
> F = fopen (NOME, "w");
> do
> {
> if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) /* recurse ? */
> BlockIndexAdd (A, ffd.cFileName, F);
> }
> while (FindNextFile (hFind, &ffd));
> FindClose (hFind);
> fclose (F);
> }
> #else
> #include <fcntl.h>
> #include <dirent.h>
> #include <string.h>
> void MakeBlockIndex (char* A)
> {
> DIR *dir;
> struct dirent *DE;
> char NOME[1024];
> FILE* F;
> SEND ("info string Reading directory %s\n", A);
> dir = opendir (A);
> if (!dir)
> {
> SEND ("info string Directory %s not found\n", A);
> return;
> }
> sprintf (NOME, "%s/BLOCK.INDEX", A);
> F = fopen (NOME, "w");
> while ((DE = readdir (dir)))
> BlockIndexAdd (A, DE->d_name, F);
> closedir (dir);
> fclose (F);
> }
> #endif
>
> /**/ /**/ /****/ /********/ /****************/ /********/ /****/ /**/ /**/
>
> static char* Name (int j, char* S)
144c240
< static void ZUG (char* A, tipo_fPOS* fpos, int r1, int r2)
---
> static void ZUG (char* A, tipo_fPOS* fpos, int r1, int r2, char* S)
160c256
< printf("%d %d\n", r1, r2);
---
> printf("%d %d %s\n", r1, r2, S);
167c263
< boolean B = FALSE;
---
> boolean B = FALSE, b;
182a279
> NOME[4] = 0;
185c282,302
< RobboTotal_registro (C, DIRECTORY);
---
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> if (i == 6)
> {
> sprintf (DIRECTORY, "%s/42/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> sprintf (DIRECTORY, "%s/33/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> sprintf (DIRECTORY, "%s/51/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> }
> sprintf (DIRECTORY, "%s/Z/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> SEARCH:
187c304
< if (v == -1)
---
> if (!b || v == -1)
254c371
< ZUG ("maximal loss", fpos, y - dPERD0, 0);
---
> ZUG ("maximal loss", fpos, y - dPERD0, 0, NOME);
265c382
< boolean b = FALSE;
---
> boolean simm = FALSE, b;
272a390
> nome[4] = 0;
278,279c396,417
< nome_canonico (C, &b);
< RobboTotal_registro (C, DIRECTORY);
---
> nome_canonico (C, &simm);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> if (i == 6)
> {
> sprintf (DIRECTORY, "%s/42/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> sprintf (DIRECTORY, "%s/33/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> sprintf (DIRECTORY, "%s/51/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> if (b)
> goto SEARCH;
> }
> sprintf (DIRECTORY, "%s/Z/", TOTAL_BASE_DIRECTORY);
> b = RobboTotal_registro (C, DIRECTORY);
> SEARCH:
281c419
< if (v == -1 || v == 0xffff)
---
> if (!b || v == -1 || v == 0xffff)
287c425
< TB->simm = b;
---
> TB->simm = simm;
290c428
< if (!b)
---
> if (!simm)
293c431
< nome_canonico (B, &b);
---
> nome_canonico (B, &simm);
314c452
< ZUG ("0:1 1:0", fpos, r1 - dPERD0, r2 - dPERD0);
---
> ZUG ("0:1 1:0", fpos, r1 - dPERD0, r2 - dPERD0, "");
316c454
< ZUG ("DRAW 1:0", fpos, 0, r1 - dPERD0);
---
> ZUG ("DRAW 1:0", fpos, 0, r1 - dPERD0, "");
318c456
< ZUG ("0:1 DRAW", fpos, r2 - dPERD0, 0);
---
> ZUG ("0:1 DRAW", fpos, r2 - dPERD0, 0, "");
diff 999953/Robbo_glue.c 999952/Robbo_glue.c
131c131
< boolean Robbo_mossa (typePOS* POSITION, uint32* am, int* v)
---
> boolean Robbo_mossa (typePOS* POSITION, uint32* am, int* v, int* cap)
133,134c133,135
< int va, v2, av = 0xff, zv = 0x00;
< typeMoveList mossa_lista[256], *q;
---
> int va, v2, av = 0xff, zv = 0x00, cp;
> typeMoveList mossa_lista[256];
> typeMoveList* q;
150c151,152
< m = q->move;
---
> m = q->move & 0x7fff;
> POSITION->StackHeight = 0; /* HACK */
151a154
> POSITION->StackHeight = 1; /* HACK */
155a159
> POSITION->StackHeight = 1; /* HACK */
160a165
> POSITION->StackHeight = 1; /* HACK */
167c172
< if (!Robbo_mossa (POSITION, &m3, &v3))
---
> if (!Robbo_mossa (POSITION, &m3, &v3, &cp))
169a175
> POSITION->StackHeight = 1; /* HACK */
172c178,181
< if (v3 > zv)
---
> if (v3 > zv &&
> ((!POSITION->DYN->cp && !(m & FLAG_MASK) &&
> ((!cp && (!(m3 & FLAG_MASK)))))
> || va <= dPERD0 + 1))
175a185
> *cap = POSITION->DYN->cp;
178a189
> POSITION->StackHeight = 1; /* HACK */
182a194
> *cap = FALSE; /* HACK */
190a203
> *cap = TRUE; /* HACK */
193d205
<
197a210
> *cap = FALSE; /* HACK */
207c220
< int va, v2;
---
> int va, v2, cp;
219c232
< if (!Robbo_mossa (POSITION, &m, &v2))
---
> if (!Robbo_mossa (POSITION, &m, &v2, &cp))
248c261
< int va, v2;
---
> int va, v2, cp;
252c265
< if (!RobboTotalBaseScore (POSITION, &va) || !Robbo_mossa (POSITION, &m, &v2))
---
> if (!RobboTotalBaseScore (POSITION, &va) || !Robbo_mossa (POSITION, &m, &v2, &cp))
254a268
> POSITION->StackHeight = 0; /* HACK */
258a273
> POSITION->StackHeight = 0; /* HACK */
259a275
> POSITION->StackHeight = 1; /* HACK */
263a280
> POSITION->StackHeight = 0; /* HACK */
266d282
< /* printf ("Iterate(%d) %o\n", POSITION->DYN - POSITION->DYN_ROOT, m); */
268a285
> POSITION->StackHeight = 1; /* HACK */
274a292
> int va;
276c294,301
< printf ("mainline: ");
---
> if (!RobboTotalBaseScore (POSITION, &va) || va == dROTT)
> {
> SEND ("info string Failure in main_line\n");
> return;
> }
> sprintf (STRING, "%d", va - dPERD0);
> printf ("mainline (%c%s): ", (va == dVITT) ? 'W' : ((va == dPATT) ? 'D' : 'L'),
> (va < dPERD0) ? "" : STRING);
279c304
< printf ("\n");
---
> SEND ("\n");
diff 999953/Robbo_iniz_IO.c 999952/Robbo_iniz_IO.c
682,684c682,686
< printf ("FOPEN failed %s\n", NOME_FILE);
< if (!F)
< return FALSE;
---
> {
> printf ("FOPEN failed %s\n", NOME_FILE);
> RobboTotal_sott (NOME);
> return FALSE;
> }
689c691
< printf ("DATA failed %s\n", NOME_FILE);
---
> printf ("iCOMP bytes failed %s\n", NOME_FILE);
690a693
> RobboTotal_sott (NOME);
748,751d750
< #if 0
< if (!memcmp (NOME, "BLOCKINDEX", 10)
< BlockIndexRegister (NOME, DIRECTORY);
< #endif
756a756,814
> static void BlockIndexRegister (char* DIR, FILE* F)
> {
> char A[16], NOME[16];
> unsigned char B[16];
> RobboTotalBase* tb;
> int i, num_indici, n, v, e;
> NOME[4] = 0;
> while (fread (B, 1, 4, F)) /* 0xee 0x63 0x70 0x41 */
> {
> if (B[0] != 0xee || B[1] != 0x63 || B[2] != 0x70 || B[3] != 0x41)
> {
> SEND ("BlockIndex mask failure!\n");
> return;
> }
> fread (NOME, 1, 4, F); /* initials of file */
> v = RobboTotal_scop (NOME);
> if (v != -1 && v != 0xffff) /* capable ? */
> {
> }
> tb = TABLE_TOTAL_BASES + NUM_TOTAL_BASES;
> RobboTotal_add (tb, NOME, DIR);
> tb->TYPE = DISCO_COMPRESSO;
> fread (A, 1, 4, F); /* block size + compression type */
> for (i = 0; i < 4; i++)
> n |= A[i] << (8 * i);
> tb->BLOCCO_pro = n & ((1 << 28) - 1);
> tb->BWT = n >> 28;
> fread (A, 1, 4, F); /* number of index count */
> num_indici = 0;
> for (i = 0; i < 4; i++)
> num_indici |= A[i] << (8 * i);
> tb->indici = malloc (4 * num_indici);
> fread (tb->indici, 4, num_indici, F); /* ENDIAN */
> TOT_INDICI += num_indici;
> for (i = 0; i < 8; i++)
> tb->supp_indice[i] = 0xffffffff;
> e = 0;
> for (i = 1; i <= num_indici - 1; i++)
> if (tb->indici[i] < tb->indici[i - 1])
> tb->supp_indice[e++] = i;
> tb->num_indici = num_indici;
> tb->Fdata = NULL;
> }
> }
>
> static boolean HasBlockIndex (char* DIR)
> {
> FILE* F;
> char NAME[256];
> sprintf (NAME, "%s/BLOCK.INDEX", DIR);
> F = fopen (NAME, "rb");
> if (!F)
> return FALSE;
> SEND ("Using BLOCK.INDEX for %s\n", DIR);
> BlockIndexRegister (DIR, F);
> fclose (F);
> return TRUE;
> }
>
763a822,823
> if (HasBlockIndex (A))
> return;
788a849,850
> if (HasBlockIndex (A))
> return;
diff 999953/Robbo_popolare.c 999952/Robbo_popolare.c
144,146c144,146
< static void
< SetupPosition (typePOS *POSITION, RobboTotalBase *TotalBase, type_PiSq *PiSq,
< uint8* DATA, uint8* MAR, uint8* VIT, uint8* PER)
---
> static void SetupPosition
> (typePOS *POSITION, RobboTotalBase *TotalBase, type_PiSq *PiSq,
> uint8* DATA, uint8* MAR, uint8* VIT, uint8* PER)
225c225
< UndoWhite (POSITION, m3);
---
> Undo (POSITION, m3);
diff 999953/SEE.c 999952/SEE.c
22c22
< int SlideIndex[4], b, w;
---
> int b, w;
31c31
< if (fr != w && LINE[to][b] != LINE[b][OppKingSq])
---
> if (fr != w && Line (to, b) != Line (b, OppKingSq))
59c59
< dir = LINE[fr][to];
---
> dir = Line (fr, to);
Only in 999952: SLAB_MEMORY.c
Only in 999952: SLAB_MEMORY.h
diff 999953/SMP_init.c 999952/SMP_init.c
4c4
< INLINE void NANO_SLEEP (int x)
---
> void NANO_SLEEP (int x)
210c210
< malloc (MAXIMUM_PLY * sizeof(typeDYNAMIC));
---
> malloc (MAXIMUM_PLY * sizeof(typeDYNAMIC)); /* SLAB_malloc */
PAWN : Knight >> Bishop >> Rook >>Queen
- kingliveson
- Posts: 1388
- Joined: Thu Jun 10, 2010 1:22 am
- Real Name: Franklin Titus
- Location: 28°32'1"N 81°22'33"W
Re: IvanHoe 999952 beta
diff 999953 999952
Code: Select all
diff 999953/UCI_OPTIONS 999952/UCI_OPTIONS
2c2
< This has a description with the UCI options for IvanHoe currently (999958-Beta).
---
> This has a description with the UCI options for IvanHoe currently (999952-Beta).
5c5
< This takes values from 1 to 65536 in megabytes, and only works for binary powers. We cannot put this information on the option itself for the various GUI insists we determine it as "Hash". Warning: upon a value who is too large, the access will be slowed. Also: a future version may release the binary powers.
---
> This takes values from 1 to 65536 in megabytes, though requires too values to regard hight bits. We cannot put this information on the option itself for the various GUI insists we determine it as "Hash". Warning: upon a value who is too large, the access will be slowed.
13c13,16
< Personal Advise: 1024 Hash, 64 PawnsHash, 64 PVHash is my usage.
---
> Option: EvalHash
> This takes values from 1 to 1024 in kilobytes!, and only works for binary powers. Do not apply this too large! Enough to reach large pages has sufficience.
>
> Personal Advise: 1024 Hash, 64 PawnsHash, 64 PVHash, 2048kb EvalHash (large).
85a89,90
> Option: StaticWeighting
> Option: MobilityWeighting
94a100,102
> Option: FixedAgeAnalysis
> This option delimits the AGE count in the hash table when in analysis. This is useful when applying forward and backward analysis as in the contrary, the AGE is incremented upon every position from the GUI. However you need to be careful and apply "ucinewgame" to shoal the hash when the higher depths entries become boggy, or when applying a independent position.
>
103a112,114
> Option: TimeImitateOpponent
> Option: TimeMoreWhenLosing
> Option: TimeMoreWhenWinning
diff 999953/Zobrist_init.c 999952/Zobrist_init.c
5,9d4
< #ifdef LINUX_LARGE_PAGES
< #include <sys/ipc.h>
< #include <sys/shm.h>
< #endif
<
12,125d6
< void IncrementAge ()
< {
< AGE += 1;
< if (AGE == MAX_AGE)
< AGE = 0;
< }
<
< /****************************** LARGE_PAGES ******************************/
<
< #ifdef LINUX_LARGE_PAGES /* acclaim to WINDOWS ? */
< static void SETUP_PRIVILEGES () {}
< static void CREATE_MEM (void** A, int align, uint64 size,
< int* w, boolean* use, char* string)
< {
< if (TRY_LARGE_PAGES)
< {
< *w = shmget (IPC_PRIVATE, size, IPC_CREAT | SHM_R | SHM_W | SHM_HUGETLB);
< if ((*w) == -1)
< MEMALIGN ((*A), align, size);
< else
< {
< (*A) = shmat ((*w), NULL, 0x0);
< (*use) = TRUE;
< SEND ("info string %s as HUGETLB %d\n", string, size >> 20);
< }
< }
< else
< {
< (*w) = -1;
< MEMALIGN ((*A), align, size);
< }
< if ((*w) == -1)
< (*use) = FALSE;
< }
<
< static void FREE_MEM (void* A, int* w, boolean* use)
< {
< if (!A)
< return;
< if ((*w) == -1)
< {
< ALIGNED_FREE (A);
< return;
< }
< shmdt (A);
< shmctl ((*w), IPC_RMID, NULL);
< (*w) = -1;
< (*use) = FALSE;
< }
< #endif
<
< #ifdef WINDOWS_LARGE_PAGES /* for the testings */
< /* http://msdn.microsoft.com/en-us/library/aa366720%28VS.85%29.aspx */
< static void CREATE_MEM
< (void** A, int align, uint64 size, int* w, boolean* use, char* string)
< {
< if (TRY_LARGE_PAGES)
< {
< (*A) = VirtualAlloc (NULL, size, MEM_LARGE_PAGES, PAGE_EXECUTE_READWRITE);
< if ((*A)) /* HACK */
< {
< (*use) = TRUE;
< SEND ("info string %s LargePages size %d\n", string, size >> 20);
< }
< else
< {
< (*use) = FALSE;
< MEMALIGN ((*A), align, size);
< }
< }
< else
< {
< (*use) = FALSE;
< MEMALIGN ((*A), align, size);
< }
< }
<
< static void FREE_MEM (void* A, int* w, boolean* use)
< {
< if (!A)
< return;
< if (!(*use))
< {
< ALIGNED_FREE (A);
< return;
< }
< VirtualFree (A, 0, MEM_RELEASE);
< }
<
< static void SETUP_PRIVILEGES ()
< /* http://msdn.microsoft.com/en-us/library/aa366543%28VS.85%29.aspx */
< {
< HANDLE token_handle;
< TOKEN_PRIVILEGES tp;
< OpenProcessToken
< (GetCurrentProcess (), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token_handle);
< LookupPrivilegeValue (NULL, TEXT ("SeLockMemoryPrivilege"), &tp.Privileges[0].Luid);
< tp.PrivilegeCount = 1;
< tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
< AdjustTokenPrivileges (token_handle, FALSE, &tp, 0, NULL, 0);
< CloseHandle (token_handle);
< }
< #endif
<
< #if !defined(LINUX_LARGE_PAGES) && !defined(WINDOWS_LARGE_PAGES)
< #define FREE_MEM(A, w, use) (ALIGNED_FREE (A))
< static void CREATE_MEM
< (void** A, int align, uint64 size, int* w, boolean* use, char* string)
< {
< MEMALIGN ((*A), align, size);
< }
< static void SETUP_PRIVILEGES () {}
< #endif
<
188a70,104
> /****************************** PAWNS HASH ******************************/
>
> static boolean LARGE_EVAL_HASH = FALSE;
> static int LARGE_EVAL_NUMBER = -1;
> void EvalHashClear ()
> {
> int c;
> for (c = 0; c < EvalHashSize; c++)
> EvalHash[c] = 0;
> }
>
> int InitEvalHash(int kb)
> {
> uint64 size;
> if (kb > 1048576)
> kb = 1048576;
> if (kb < 1)
> kb = 1;
> EvalHashSize = ((1ULL << BSR (kb)) << 10) / sizeof (uint64);
> EVAL_HASH_MASK = EvalHashSize - 1;
> kb = (EvalHashSize * sizeof (uint64)) >> 10;
> if (EvalHash)
> FREE_MEM (EvalHash, &LARGE_EVAL_NUMBER, &LARGE_EVAL_HASH);
> size = EvalHashSize * sizeof (uint64);
> if (TRY_LARGE_PAGES) /* HACK */
> size = MAX ((1 << 21), size);
> CREATE_MEM (&EvalHash, 64, size,
> &LARGE_EVAL_NUMBER, &LARGE_EVAL_HASH, "EvalHash");
> EvalHashClear ();
> return kb;
> }
>
> void QUIT_EVAL_HASH()
> { FREE_MEM (EvalHash, &LARGE_EVAL_NUMBER, &LARGE_EVAL_HASH); }
>
272a189,190
> InitEvalHash ((EvalHashSize * sizeof (uint64)) >> 10); /* HACK */
> InitSlab (4); /* HACK */
diff 999953/Zobrist_use.c 999952/Zobrist_use.c
7a8,14
> void IncrementAge ()
> {
> AGE += 1;
> if (AGE == MAX_AGE)
> AGE = 0;
> }
>
diff 999953/all_node.c 999952/all_node.c
386,388c386
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/arrays.c 999952/arrays.c
81c81
< ZobristWTM = GET_RAND ();
---
> GET_RAND (); /* HACK */
98c98
< ZOBRIST[i][j] = GET_RAND ();
---
> Zobrist (i, j) = GET_RAND ();
146c146
<
---
> #ifndef MAGIC_BITBOARDS
159c159
<
---
> #endif
287c287
< AttNormal[co + 8 * i][u >> 1] = T << (8 * i);
---
> AttNORMAL (co + 8 * i, u >> 1) = T << (8 * i);
382,383c382,383
< T = AttNormal[Left90[sq]][i];
< AttLeft90[sq][i] = 0;
---
> T = AttNORMAL (Left90[sq], i);
> AttLEFT90 (sq, i) = 0;
387c387
< AttLeft90[sq][i] |= SqSet[LEFT09[b]];
---
> AttLEFT90 (sq, i) |= SqSet[LEFT09[b]];
398c398
< AttRight45[RIGHT54[sq]][u >> 1] = 0;
---
> AttRIGHT45 (RIGHT54[sq], u >> 1) = 0;
425,426c425
< AttRight45[RIGHT54[sq]][u >> 1] |=
< SqSet[RIGHT54[b]];
---
> AttRIGHT45 (RIGHT54[sq], u >> 1) |= SqSet[RIGHT54[b]];
437c436
< AttLeft45[LEFT54[sq]][u >> 1] = 0;
---
> AttLEFT45 (LEFT54[sq], u >> 1) = 0;
464,465c463
< AttLeft45[LEFT54[sq]][u >> 1] |=
< SqSet[LEFT54[b]];
---
> AttLEFT45 (LEFT54[sq], u >> 1) |= SqSet[LEFT54[b]];
538c536
< EVADE[king][sq] = AttK[king];
---
> Evade (king, sq) = AttK[king];
542c540
< EVADE[king][sq] ^= SqSet[king - 1];
---
> Evade (king, sq) ^= SqSet[king - 1];
544c542
< EVADE[king][sq] ^= SqSet[king + 1];
---
> Evade (king, sq) ^= SqSet[king + 1];
549c547
< EVADE[king][sq] ^= SqSet[king - 8];
---
> Evade (king, sq) ^= SqSet[king - 8];
551c549
< EVADE[king][sq] ^= SqSet[king + 8];
---
> Evade (king, sq) ^= SqSet[king + 8];
556c554
< EVADE[king][sq] ^= SqSet[king + 9];
---
> Evade (king, sq) ^= SqSet[king + 9];
558c556
< EVADE[king][sq] ^= SqSet[king - 9];
---
> Evade (king, sq) ^= SqSet[king - 9];
563c561
< EVADE[king][sq] ^= SqSet[king + 7];
---
> Evade (king, sq) ^= SqSet[king + 7];
565c563
< EVADE[king][sq] ^= SqSet[king - 7];
---
> Evade (king, sq) ^= SqSet[king - 7];
568c566
< EVADE[king][sq] |= SqSet[sq];
---
> Evade (king, sq) |= SqSet[sq];
583c581
< INTERPOSE[king][sq] = SqSet[sq];
---
> InterPose (king, sq) = SqSet[sq];
615c613
< BitSet (i, INTERPOSE[king][sq]);
---
> BitSet (i, InterPose (king, sq));
645c643
< LINE[i][j] = BAD_DIRECTION;
---
> Line (i, j) = BAD_DIRECTION;
649c647
< LINE[i][j] = Direction_horz;
---
> Line (i, j) = Direction_horz;
651c649
< LINE[i][j] = Direction_vert;
---
> Line (i, j) = Direction_vert;
653c651
< LINE[i][j] = Direction_a1h8;
---
> Line (i, j) = Direction_a1h8;
655c653
< LINE[i][j] = Direction_h1a8;
---
> Line (i, j) = Direction_h1a8;
656a655
> randkey = 1; /* HACK */
diff 999953/arrays.h 999952/arrays.h
1a2,9
> /* SLAB ALL? */
>
> SLAB_DECLARE1 (uint64, AttN, 64);
> SLAB_DECLARE1 (uint64, AttK, 64);
> SLAB_DECLARE1 (uint64, AttPw, 64);
> SLAB_DECLARE1 (uint64, AttPb, 64);
>
> #ifndef MAGIC_BITBOARDS
5,7c13,16
<
< uint64 AttN[64], AttK[64], AttPw[64], AttPb[64];
< #ifndef MAGIC_BITBOARDS
---
> #ifdef ONE_DIMENSIONAL
> SLAB_DECLARE3 (uint64, LineMask, 4 * 0100 * 0100);
> SLAB_DECLARE3 (int, LineShift, 4 * 0100);
> #else
10a20,28
> SLAB_DECLARE1 (uint64, ClearL90, 64);
> SLAB_DECLARE1 (uint64, ClearL45, 64);
> SLAB_DECLARE1 (uint64, ClearR45, 64);
> SLAB_DECLARE1 (uint64, SetL90, 64);
> SLAB_DECLARE1 (uint64, SetL45, 64);
> SLAB_DECLARE1 (uint64, SetR45, 64);
> #endif
>
> /****************/ /****************/ /****************/ /****************/
44,45c62,130
< uint64 SqSet[64], SqClear[64], NON_DIAG[64], NON_ORTHO[64];
< uint64 ORTHO[64], DIAG[64], ORTHO_DIAG[64];
---
> /****************/ /****************/ /****************/ /****************/
>
> SLAB_DECLARE1 (uint64, SqSet, 64);
> SLAB_DECLARE1 (uint64, SqClear, 64);
> SLAB_DECLARE1 (uint64, NON_DIAG, 64);
> SLAB_DECLARE1 (uint64, NON_ORTHO, 64);
> SLAB_DECLARE1 (uint64, ORTHO, 64);
> SLAB_DECLARE1 (uint64, DIAG, 64);
> SLAB_DECLARE1 (uint64, ORTHO_DIAG, 64);
>
> SLAB_DECLARE1 (uint64, OpenFileW, 64);
> SLAB_DECLARE1 (uint64, OpenFileB, 64);
> SLAB_DECLARE1 (uint64, PassedPawnW, 64);
> SLAB_DECLARE1 (uint64, PassedPawnB, 64);
> SLAB_DECLARE1 (uint64, ProtectedPawnW, 64);
> SLAB_DECLARE1 (uint64, ProtectedPawnB, 64);
> SLAB_DECLARE1 (uint64, IsolatedPawnW, 64);
> SLAB_DECLARE1 (uint64, IsolatedPawnB, 64);
> SLAB_DECLARE1 (uint64, ConnectedPawns, 64);
>
> SLAB_DECLARE1 (uint64, InFrontW, 8);
> SLAB_DECLARE1 (uint64, NotInFrontW, 8);
> SLAB_DECLARE1 (uint64, InFrontB, 8);
> SLAB_DECLARE1 (uint64, NotInFrontB, 8);
> SLAB_DECLARE1 (uint64, IsolatedFiles, 8);
> SLAB_DECLARE1 (uint64, FilesLeft, 8);
> SLAB_DECLARE1 (uint64, FilesRight, 8);
>
> SLAB_DECLARE1 (uint64, DOUBLED, 64);
> SLAB_DECLARE1 (uint64, LEFT2, 64);
> SLAB_DECLARE1 (uint64, RIGHT2, 64);
> SLAB_DECLARE1 (uint64, LEFT1, 64);
> SLAB_DECLARE1 (uint64, RIGHT1, 64);
> SLAB_DECLARE1 (uint64, ADJACENT, 64);
> SLAB_DECLARE1 (uint64, LONG_DIAG, 64);
> SLAB_DECLARE1 (uint64, NORTHWEST, 64);
> SLAB_DECLARE1 (uint64, SOUTHWEST, 64);
> SLAB_DECLARE1 (uint64, NORTHEAST, 64);
> SLAB_DECLARE1 (uint64, SOUTHEAST, 64);
>
> SLAB_DECLARE1 (uint64, QuadrantWKwtm, 64);
> SLAB_DECLARE1 (uint64, QuadrantBKwtm, 64);
> SLAB_DECLARE1 (uint64, QuadrantWKbtm, 64);
> SLAB_DECLARE1 (uint64, QuadrantBKbtm, 64);
> SLAB_DECLARE1 (uint64, ShepherdWK, 64);
> SLAB_DECLARE1 (uint64, ShepherdBK, 64);
>
> #ifdef ONE_DIMENSIONAL /* one-dimensional */
> #define InterPose(x, y) INTERPOSE[64 * (x) + (y)]
> #define Evade(x, y) EVADE[64 * (x) + (y)]
> #define Line(x, y) LINE[64 * (x) + (y)]
> #define Zobrist(pi, sq) ZOBRIST[64 * (pi) + (sq)]
> SLAB_DECLARE3 (uint64, INTERPOSE, 0100 * 0100);
> SLAB_DECLARE3 (uint64, EVADE, 0100 * 0100);
> SLAB_DECLARE3 (sint8, LINE, 0100 * 0100);
> SLAB_DECLARE3 (uint64, ZOBRIST, 0x10 * 0100);
> #else
> #define InterPose(x, y) INTERPOSE[x][y]
> #define Evade(x, y) EVADE[x][y]
> #define Line(x, y) LINE[x][y]
> #define Zobrist(pi, sq) ZOBRIST[pi][sq]
> uint64 INTERPOSE[64][64], EVADE[64][64];
> sint8 LINE[64][64]; /* onely in SEE */
> uint64 ZOBRIST[16][64];
> #endif
>
> SLAB_DECLARE1 (uint64, ZobristCastling, 16);
> SLAB_DECLARE1 (uint64, ZobristEP, 8);
> #define ZobristWTM 0x1220ab8c8d92bd3d /* const */
66,71d150
< uint64 OpenFileW[64], OpenFileB[64], PassedPawnW[64], PassedPawnB[64];
< uint64 ProtectedPawnW[64], ProtectedPawnB[64];
< uint64 IsolatedPawnB[64], IsolatedPawnW[64], ConnectedPawns[64];
< uint64 InFrontW[8], NotInFrontW[8], InFrontB[8], NotInFrontB[8], IsolatedFiles[8];
< uint64 FilesLeft[8], FilesRight[8];
<
78,92d156
<
< uint64 DOUBLED[64];
<
< uint64 LEFT2[64], RIGHT2[64], LEFT1[64], RIGHT1[64], ADJACENT[64], LONG_DIAG[64];
<
< uint64 QuadrantWKwtm[64], QuadrantBKwtm[64];
< uint64 QuadrantWKbtm[64], QuadrantBKbtm[64];
< uint64 ShepherdWK[64], ShepherdBK[64];
<
< uint64 INTERPOSE[64][64], EVADE[64][64];
< uint64 NORTHWEST[64], SOUTHWEST[64], NORTHEAST[64], SOUTHEAST[64];
< uint64
< ClearL90[64], ClearL45[64], ClearR45[64], SetL90[64], SetL45[64], SetR45[64];
< sint8 LINE[64][64];
< uint64 ZobristCastling[16], ZOBRIST[16][64], ZobristEP[8], ZobristWTM;
diff 999953/common.h 999952/common.h
22,28c22
< #ifdef MULTIPLE_POS_GAIN
< #define MAX_POSITIONAL(x) \
< ((int) MAX_POSITIONAL_GAIN[POSITION->cpu][POSITION->sq[FROM(x)]][x & 07777])
< #else
< #define MAX_POSITIONAL(x) \
< ((int) MAX_POSITIONAL_GAIN[POSITION->sq[FROM(x)]][x & 07777])
< #endif
---
> #define MAX_POSITIONAL(m) MAX_POS_GAIN (POSITION->sq[FROM (m)], (m) & 07777)
diff 999953/control.c 999952/control.c
22d21
< #if 1 /* ? */
29d27
< #endif
364,365c362,363
< #if 0 /* about the 0.6 elo for the hasslings */ /* measure to UCI? */
< if (!mtg)
---
> #if 1
> if (TIME_IMITATE && !mtg)
384,388c382,402
< #if 0
< if (ROOT_DEPTH && ROOT_SCORE < -50)
< DESIRED_TIME += DESIRED_TIME >> 3;
< if (ROOT_DEPTH && ROOT_SCORE < -100)
< DESIRED_TIME += DESIRED_TIME >> 3;
---
> #if 1
> if (ROOT_DEPTH && TIME_LOSE_MORE && DESIRED_TIME > 1000000)
> {
> if (ROOT_SCORE < -25 && ROOT_SCORE >= -50)
> DESIRED_TIME += DESIRED_TIME >> 3;
> if (ROOT_SCORE < -50 && ROOT_SCORE >= -75)
> DESIRED_TIME += DESIRED_TIME >> 2;
> if (ROOT_SCORE < -75 && ROOT_SCORE >= -100)
> DESIRED_TIME += DESIRED_TIME >> 3;
> }
> #endif
> #if 1
> if (ROOT_DEPTH && TIME_WIN_MORE && DESIRED_TIME > 1000000)
> {
> if (ROOT_SCORE > 25 && ROOT_SCORE <= 50)
> DESIRED_TIME += DESIRED_TIME >> 3;
> if (ROOT_SCORE > 50 && ROOT_SCORE <= 75)
> DESIRED_TIME += DESIRED_TIME >> 2;
> if (ROOT_SCORE > 75 && ROOT_SCORE <= 100)
> DESIRED_TIME += DESIRED_TIME >> 3;
> }
diff 999953/cut_node.c 999952/cut_node.c
459,461c459
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/eval_explain.c 999952/eval_explain.c
47,50d46
< #define HashSize ( 0x8000 ) /* larger makes NPS drop with memory access */
< #define HASH_MASK ( (HashSize) - 1 )
<
< extern uint64 EvalHash[HashSize]; /* non atomico con 32-bits ? */
401c397
< if (((POSITION->DYN->HASH ^ EvalHash[POSITION->DYN->HASH & HASH_MASK]) &
---
> if (((POSITION->DYN->HASH ^ EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK]) &
405c401
< (int) ((sint16) (EvalHash[POSITION->DYN->HASH & HASH_MASK] & 0xffff));
---
> (int) ((sint16) (EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] & 0xffff));
442c438
< EvalHash[POSITION->DYN->HASH & HASH_MASK] =
---
> EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
467c463
< EvalHash[POSITION->DYN->HASH & HASH_MASK] =
---
> EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
495,496c491
< Value = PieceSquareValue[POSITION->sq[to]][to]
< - PieceSquareValue[POSITION->sq[to]][FROM (move)];
---
> Value = PST (POSITION->sq[to], to) - PST (POSITION->sq[to], FROM (move));
498c493
< Value -= PieceSquareValue[cp][to];
---
> Value -= PST (cp, to);
521,522c516
< Value = PieceSquareValue[POSITION->sq[to]][to]
< - PieceSquareValue[POSITION->sq[to]][FROM (move)];
---
> Value = PST (POSITION->sq[to], to) - PST (POSITION->sq[to], FROM (move));
524c518
< Value -= PieceSquareValue[cp][to];
---
> Value -= PST (cp, to);
608c602
< (AttB | AttR ) & bKatt ? '*' : ' ', OpEg (PieceSquareValue[wEnumQ][b]));
---
> (AttB | AttR ) & bKatt ? '*' : ' ', OpEg (PST (wEnumQ, b)));
679c673
< A & bKatt ? '*' : ' ', OpEg (PieceSquareValue[wEnumR][b]));
---
> A & bKatt ? '*' : ' ', OpEg (PST (wEnumR, b)));
832c826
< A & bKatt ? '*' : ' ', OpEg (PieceSquareValue[wEnumBL][b]));
---
> A & bKatt ? '*' : ' ', OpEg (PST (wEnumBL, b)));
939c933
< A & (bKatt | bBitboardK) ? '*' : ' ', OpEg (PieceSquareValue[wEnumN][b]));
---
> A & (bKatt | bBitboardK) ? '*' : ' ', OpEg (PST (wEnumN, b)));
1038c1032
< (AttB | AttR ) & wKatt ? '*' : ' ', OpEg (PieceSquareValue[bEnumQ][b]));
---
> (AttB | AttR ) & wKatt ? '*' : ' ', OpEg (PST (bEnumQ, b)));
1110c1104
< A & wKatt ? '*' : ' ', OpEg (PieceSquareValue[bEnumR][b]));
---
> A & wKatt ? '*' : ' ', OpEg (PST (bEnumR, b)));
1261c1255
< A & wKatt ? '*' : ' ', OpEg (PieceSquareValue[bEnumBL][b]));
---
> A & wKatt ? '*' : ' ', OpEg (PST (bEnumBL, b)));
1369c1363
< A & (wKatt | wBitboardK) ? '*' : ' ', OpEg (PieceSquareValue[bEnumN][b]));
---
> A & (wKatt | wBitboardK) ? '*' : ' ', OpEg (PST (bEnumN, b)));
1854c1848
< EvalHash[POSITION->DYN->HASH & HASH_MASK] =
---
> EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
diff 999953/evaluation.c 999952/evaluation.c
30a31
> /* SLAB?? */
54,65d54
< #define HashSize ( 0x8000 ) /* larger makes NPS drop with memory access */
< #define EVAL_HASH_MASK ( (HashSize) - 1 )
<
< uint64 EvalHash[HashSize]; /* non atomico con 32-bits ? */
<
< void EvalHashClear ()
< {
< int c;
< for (c = 0; c < HashSize; c++)
< EvalHash[c] = 0;
< }
<
88,89c77,78
< static void KingPawnWhite (typePOS* POSITION, int matval, uint8 TOKEN,
< typePawnEval* PAWN_INFO)
---
> static void KingPawnWhite
> (typePOS* POSITION, int matval, uint8 TOKEN, typePawnEval* PAWN_INFO)
214,215c203,204
< static void KingPawnBlack (typePOS* POSITION, int matval, uint8 TOKEN,
< typePawnEval* PAWN_INFO)
---
> static void KingPawnBlack
> (typePOS* POSITION, int matval, uint8 TOKEN, typePawnEval* PAWN_INFO)
339a329,330
> #define EVAL_TWEAK 0x12345678
> #define GET_EVAL_HASH(Z) EvalHash[(Z ^ EVAL_TWEAK) & EVAL_HASH_MASK]
343c334
< int index, matval, Value;
---
> int index, matval, Value, MobValue = 0;
356,358c347
< #ifdef ZUGZWANG_DETECT
< boolean wzug = TRUE, bzug = TRUE;
< #endif
---
> ZUGZWANG_DETECT_DECLARE;
391c380
< if (((POSITION->DYN->HASH ^ EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK]) &
---
> if (((POSITION->DYN->HASH ^ GET_EVAL_HASH (POSITION->DYN->HASH)) &
394,395c383
< Value =
< (int) ((sint16) (EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] & 0xffff));
---
> Value = (int) ((sint16) (GET_EVAL_HASH (POSITION->DYN->HASH) & 0xffff));
408,440d395
< #if 0 && defined (CON_ROBBO_BUILD) /* until freeload TripleBases have availed */
< boolean RobboTotalBaseScore (typePOS*, int*);
< #define dVITT 0x01
< #define dPATT 0x02
< #define DISCO_VITTORIA(x) ((x) == dVITT)
< #define DISCO_PATTA(x) ((x) == dPATT)
< #define ROBBO_TOTAL_CONDITION_SEARCH(POS) \
< (USE_TOTAL_BASES_IN_SEARCH /* FALSE in always, compile for TRUE, no UCI */ \
< && POPCNT (POS->OccupiedBW ^ (wBitboardP & (bBitboardP >> 8))) == 6)
< if (SEARCH_ROBBO_BASES && ROBBO_TOTAL_CONDITION_SEARCH (POSITION)) /* HACK */
< {
< int va;
< if (RobboTotalBaseScore (POSITION, &va))
< {
< int c = POPCNT (POSITION->OccupiedBW);
< int molt = 21000 - (128 * c) - 64 * HEIGHT (POSITION);
< if (DISCO_PATTA (va))
< POSITION->DYN->Value = 0;
< else
< {
< POSITION->DYN->Value = (DISCO_VITTORIA (va) > 0) ? molt : -molt;
< POSITION->DYN->Value += (POSITION->wtm ? matval : -matval);
< }
< POSITION->DYN->lazy = 1;
< POSITION->DYN->PositionalValue = 0;
< EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
< (POSITION->DYN->HASH & 0xffffffffffff0000) |
< (POSITION->DYN->Value & 0xffff);
< POSITION->DYN->exact = TRUE;
< return;
< }
< }
< #endif
459c414
< EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
---
> GET_EVAL_HASH (POSITION->DYN->HASH) =
482c437
< EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
---
> GET_EVAL_HASH (POSITION->DYN->HASH) =
508,509c463
< Value = PieceSquareValue[POSITION->sq[to]][to]
< - PieceSquareValue[POSITION->sq[to]][FROM (move)];
---
> Value = PST (POSITION->sq[to], to) - PST (POSITION->sq[to], FROM (move));
511c465
< Value -= PieceSquareValue[cp][to];
---
> Value -= PST (cp, to);
534,535c488
< Value = PieceSquareValue[POSITION->sq[to]][to]
< - PieceSquareValue[POSITION->sq[to]][FROM (move)];
---
> Value = PST (POSITION->sq[to], to) - PST (POSITION->sq[to], FROM (move));
537c490
< Value -= PieceSquareValue[cp][to];
---
> Value -= PST (cp, to);
563a517
> #if 0
564a519,528
> #else
> Value = (PAWN_INFO->SCORE);
> end = (sint16) (POSITION->DYN->STATIC & 0xffff);
> open = (end < 0) + (sint16) ((POSITION->DYN->STATIC >> 16) & 0xffff);
> open *= UCI_STATIC_WEIGHTING;
> open >>= 10;
> end *= UCI_STATIC_WEIGHTING;
> end >>= 10;
> Value += SCORE (open, end);
> #endif
600c564
< Value -= PawnAntiMobility;
---
> MobValue -= PawnAntiMobility;
634,637c598
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
645c606
< Value += MobQ (T);
---
> MobValue += MobQ (T);
670,673c631
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
691c649
< Value += MobR (A & wOKxray);
---
> MobValue += MobR (A & wOKxray);
778,781c736
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
799c754
< Value += MobB (A & wSafeMob, InFrontW[RANK (b)]);
---
> MobValue += MobB (A & wSafeMob, InFrontW[RANK (b)]);
854,857c809
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
865c817
< Value += MobN (A & wSafeMob, InFrontW[RANK (b)]);
---
> MobValue += MobN (A & wSafeMob, InFrontW[RANK (b)]);
910c862
< Value += PawnAntiMobility;
---
> MobValue += PawnAntiMobility;
943,946c895
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
955c904
< Value -= MobQ (T);
---
> MobValue -= MobQ (T);
982,985c931
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
1003c949
< Value -= MobR (A & bOKxray);
---
> MobValue -= MobR (A & bOKxray);
1090,1093c1036
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
1111c1054
< Value -= MobB (A & bSafeMob, InFrontB[RANK (b)]);
---
> MobValue -= MobB (A & bSafeMob, InFrontB[RANK (b)]);
1168,1171c1111
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
1179c1119
< Value -= MobN (A & bSafeMob, InFrontB[RANK (b)]);
---
> MobValue -= MobN (A & bSafeMob, InFrontB[RANK (b)]);
1214a1155,1164
> #if 1
> end = (sint16) (MobValue & 0xffff);
> open = (end < 0) + (sint16) ((MobValue >> 16) & 0xffff);
> open *= UCI_MOBILITY_WEIGHTING;
> open >>= 10;
> end *= UCI_MOBILITY_WEIGHTING;
> end >>= 10;
> MobValue = SCORE (open, end);
> #endif
> Value += MobValue;
1547,1552c1497
< #ifdef ZUGZWANG_DETECT
< if (wzug)
< POSITION->DYN->flags &= ~2;
< if (bzug)
< POSITION->DYN->flags &= ~1;
< #endif
---
> ZUGZWANG_DETECT_COMPLETE;
1556c1501
< EvalHash[POSITION->DYN->HASH & EVAL_HASH_MASK] =
---
> GET_EVAL_HASH (POSITION->DYN->HASH) =
diff 999953/evaluation.v 999952/evaluation.v
5c5
< #define Bitboard2(x,y) (1ULL << (x))|(1ULL << (y))
---
> #define Bitboard2(x, y) (1ULL << (x))|(1ULL << (y))
diff 999953/exclude_node.c 999952/exclude_node.c
48c48
< zob ^= ZOBRIST[EnumMyK][FROM (MOVE)] ^ ZOBRIST[EnumOppK][TO (MOVE)];
---
> zob ^= Zobrist (EnumMyK, FROM (MOVE)) ^ Zobrist (EnumOppK, TO (MOVE));
280c280
< zob ^= ZOBRIST[EnumMyK][FROM (MOVE)] ^ ZOBRIST[EnumOppK][TO (MOVE)];
---
> zob ^= Zobrist (EnumMyK, FROM (MOVE)) ^ Zobrist (EnumOppK, TO (MOVE));
388,390c388
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/functions.h 999952/functions.h
5a6,9
> void InitSlab (int);
>
> void CREATE_MEM (void**, int, uint64, int*, boolean*, char*);
> void FREE_MEM (void*, int*, boolean*);
14a19
> int InitEvalHash (int);
69a75,76
>
> int Move50 (typePOS *);
diff 999953/input.c 999952/input.c
99a100,101
> { "EvalHash", UCI_SPIN, 1, 1048576, 256, NULL, &InitEvalHash },
> { "SmallEvalHash", UCI_CHECK, 0, 0, FALSE, &SMALL_EVAL_HASH },
144a147,148
> { "StaticWeighting", UCI_SPIN, 512, 2048, 1024, &UCI_STATIC_WEIGHTING, NULL},
> { "MobilityWeighting", UCI_SPIN, 512, 2048, 1024, &UCI_MOBILITY_WEIGHTING, NULL},
147a152
> { "FixedAgeAnalysis", UCI_CHECK, 0, 0, FALSE, &FIXED_AGE_ANALYSIS, NULL},
153a159,161
> { "TimeImitateOpponent", UCI_CHECK, 0, 0, FALSE, &TIME_IMITATE, NULL},
> { "TimeMoreWhenLosing", UCI_CHECK, 0, 0, FALSE, &TIME_LOSE_MORE, NULL},
> { "TimeMoreWhenWinning", UCI_CHECK, 0, 0, FALSE, &TIME_WIN_MORE, NULL},
274a283,284
> QUIT_EVAL_HASH ();
> DeleteSlab ();
diff 999953/low_depth.c 999952/low_depth.c
331,333c331
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/main.c 999952/main.c
8,9c8,9
< int cpu;
< for (cpu = 0; cpu < MAX_CPUS; cpu++)
---
> typePOS POSITION[1]; /* HACK */
> for (POSITION->cpu = 0; POSITION->cpu < MAX_CPUS; POSITION->cpu++)
13,17c13
< #ifdef MULTIPLE_POS_GAIN
< MAX_POSITIONAL_GAIN[cpu][p][m] = 0;
< #else
< MAX_POSITIONAL_GAIN[p][m] = 0;
< #endif
---
> MAX_POS_GAIN (p, m) = 0;
24,25c20,21
< int cpu;
< for (cpu = 0; cpu < MAX_CPUS; cpu++)
---
> typePOS POSITION[1]; /* HACK */
> for (POSITION->cpu = 0; POSITION->cpu < MAX_CPUS; POSITION->cpu++)
29,33c25
< #ifdef MULTIPLE_HISTORY
< HISTORY[cpu][pi][sq] = 0x800;
< #else
< HISTORY[pi][sq] = 0x800;
< #endif
---
> HISTORY_PI_TO (POSITION, pi, sq) = 0x800;
65a58,59
> PVHashTable = NULL;
> EvalHash = NULL;
67a62
> EvalHashSize = (1 << 15); /* HACK */
69,70c64
< ROOT_POSIZIONE0->DYN_ROOT =
< malloc (MAXIMUM_PLY * sizeof (typeDYNAMIC));
---
> ROOT_POSIZIONE0->DYN_ROOT = malloc (MAXIMUM_PLY * sizeof (typeDYNAMIC));
78,85d71
< InitPawnHash (2);
< CURRENT_HASH_SIZE = 32;
< InitHash (32);
< InitPVHash (2);
< ResetHistory ();
< InitCaptureValues ();
< InitArrays ();
< InitPawns ();
103,104c89,103
< InitMaterialValue ();
< InitStatic ();
---
> UCI_STATIC_WEIGHTING = 1024;
> UCI_MOBILITY_WEIGHTING = 1024;
>
> InitPawnHash (2);
> CURRENT_HASH_SIZE = 32;
> InitHash (32);
> InitPVHash (2);
> InitEvalHash (256);
> #ifdef SLAB_MEMORY
> InitSlab (4);
> #else
> InitSlab (0);
> #endif
> InitCaptureValues (); /* SLAB_MEM */
> InitPawns (); /* SLAB_MEM? */
114a114,116
> TIME_IMITATE = FALSE;
> TIME_LOSE_MORE = FALSE;
> TIME_WIN_MORE = FALSE;
135a138
> FIXED_AGE_ANALYSIS = FALSE;
170d172
< USE_TOTAL_BASES_IN_SEARCH = FALSE;
diff 999953/make_move.c 999952/make_move.c
46,48c46,47
< POSITION->DYN->STATIC +=
< PieceSquareValue[wEnumR][F1] - PieceSquareValue[wEnumR][H1];
< POSITION->DYN->HASH ^= ZOBRIST[wEnumR][F1] ^ ZOBRIST[wEnumR][H1];
---
> POSITION->DYN->STATIC += PST (wEnumR, F1) - PST (wEnumR, H1);
> POSITION->DYN->HASH ^= Zobrist (wEnumR, F1) ^ Zobrist (wEnumR, H1);
62,64c61,62
< POSITION->DYN->STATIC +=
< PieceSquareValue[wEnumR][D1] - PieceSquareValue[wEnumR][A1];
< POSITION->DYN->HASH ^= ZOBRIST[wEnumR][A1] ^ ZOBRIST[wEnumR][D1];
---
> POSITION->DYN->STATIC += PST (wEnumR, D1) - PST (wEnumR, A1);
> POSITION->DYN->HASH ^= Zobrist (wEnumR, A1) ^ Zobrist (wEnumR, D1);
82,84c80,81
< POSITION->DYN->STATIC +=
< PieceSquareValue[bEnumR][F8] - PieceSquareValue[bEnumR][H8];
< POSITION->DYN->HASH ^= ZOBRIST[bEnumR][F8] ^ ZOBRIST[bEnumR][H8];
---
> POSITION->DYN->STATIC += PST (bEnumR, F8) - PST (bEnumR, H8);
> POSITION->DYN->HASH ^= Zobrist (bEnumR, F8) ^ Zobrist (bEnumR, H8);
98,100c95,96
< POSITION->DYN->STATIC +=
< PieceSquareValue[bEnumR][D8] - PieceSquareValue[bEnumR][A8];
< POSITION->DYN->HASH ^= ZOBRIST[bEnumR][A8] ^ ZOBRIST[bEnumR][D8];
---
> POSITION->DYN->STATIC += PST (bEnumR, D8) - PST (bEnumR, A8);
> POSITION->DYN->HASH ^= Zobrist (bEnumR, A8) ^ Zobrist (bEnumR, D8);
143,144c139,140
< POSITION->DYN->STATIC += PieceSquareValue[pi][to] - PieceSquareValue[pi][fr];
< mask = ZOBRIST[pi][fr] ^ ZOBRIST[pi][to];
---
> POSITION->DYN->STATIC += PST (pi, to) - PST (pi, fr);
> mask = Zobrist (pi, fr) ^ Zobrist (pi, to);
164c160
< POSITION->DYN->STATIC -= PieceSquareValue[cp][to];
---
> POSITION->DYN->STATIC -= PST (cp, to);
166,167c162,163
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[cp][to];
< POSITION->DYN->HASH ^= ZOBRIST[cp][to];
---
> POSITION->DYN->PAWN_HASH ^= Zobrist (cp, to);
> POSITION->DYN->HASH ^= Zobrist (cp, to);
194,196c190,192
< POSITION->DYN->STATIC -= PieceSquareValue[bEnumP][z];
< POSITION->DYN->HASH ^= ZOBRIST[bEnumP][z];
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[bEnumP][z];
---
> POSITION->DYN->STATIC -= PST (bEnumP, z);
> POSITION->DYN->HASH ^= Zobrist (bEnumP, z);
> POSITION->DYN->PAWN_HASH ^= Zobrist (bEnumP, z);
211,215c207,209
< POSITION->DYN->STATIC +=
< PieceSquareValue[pi][to] - PieceSquareValue[wEnumP][to];
< POSITION->DYN->HASH ^=
< ZOBRIST[pi][to] ^ ZOBRIST[wEnumP][to];
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[wEnumP][to];
---
> POSITION->DYN->STATIC += PST (pi, to) - PST (wEnumP, to);
> POSITION->DYN->HASH ^= Zobrist (pi, to) ^ Zobrist (wEnumP, to);
> POSITION->DYN->PAWN_HASH ^= Zobrist (wEnumP, to);
262,263c256,257
< POSITION->DYN->STATIC += PieceSquareValue[pi][to] - PieceSquareValue[pi][fr];
< mask = ZOBRIST[pi][fr] ^ ZOBRIST[pi][to];
---
> POSITION->DYN->STATIC += PST (pi, to) - PST (pi, fr);
> mask = Zobrist (pi, fr) ^ Zobrist (pi, to);
283c277
< POSITION->DYN->STATIC -= PieceSquareValue[cp][to];
---
> POSITION->DYN->STATIC -= PST (cp, to);
285,286c279,280
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[cp][to];
< POSITION->DYN->HASH ^= ZOBRIST[cp][to];
---
> POSITION->DYN->PAWN_HASH ^= Zobrist (cp, to);
> POSITION->DYN->HASH ^= Zobrist (cp, to);
313,315c307,309
< POSITION->DYN->STATIC -= PieceSquareValue[wEnumP][z];
< POSITION->DYN->HASH ^= ZOBRIST[wEnumP][z];
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[wEnumP][z];
---
> POSITION->DYN->STATIC -= PST (wEnumP, z);
> POSITION->DYN->HASH ^= Zobrist (wEnumP, z);
> POSITION->DYN->PAWN_HASH ^= Zobrist (wEnumP, z);
330,334c324,326
< POSITION->DYN->STATIC +=
< PieceSquareValue[pi][to] - PieceSquareValue[bEnumP][to];
< POSITION->DYN->HASH ^=
< ZOBRIST[pi][to] ^ ZOBRIST[bEnumP][to];
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[bEnumP][to];
---
> POSITION->DYN->STATIC += PST (pi, to) - PST (bEnumP, to);
> POSITION->DYN->HASH ^= Zobrist (pi, to) ^ Zobrist (bEnumP, to);
> POSITION->DYN->PAWN_HASH ^= Zobrist (bEnumP, to);
347d338
< VALIDATE (POSITION, 0, move);
diff 999953/mobility.c 999952/mobility.c
8,10c8
< #ifdef ZUGZWANG_DETECT
< boolean wzug = TRUE, bzug = TRUE;
< #endif
---
> ZUGZWANG_DETECT_DECLARE;
29,32c27
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
41,44c36
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
60,63c52
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
81,84c70
< #ifdef ZUGZWANG_DETECT
< if (A & ~wBitboardOcc)
< wzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_WHITE;
107,110c93
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
119,122c102
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
138,141c118
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
159,162c136
< #ifdef ZUGZWANG_DETECT
< if (A & ~bBitboardOcc)
< bzug = FALSE;
< #endif
---
> ZUGZWANG_DETECT_FACT_BLACK;
197,202c171
< #ifdef ZUGZWANG_DETECT
< if (wzug)
< POSITION->DYN->flags &= ~2;
< if (bzug)
< POSITION->DYN->flags &= ~1;
< #endif
---
> ZUGZWANG_DETECT_COMPLETE;
diff 999953/move_gen.c 999952/move_gen.c
19d18
< #ifdef MULTIPLE_HISTORY
22,27c21
< | ( HISTORY[POSITION->cpu][pi][to] << 16); }
< #else
< #define MoveAdd(L, x, pi, to, check) \
< { (L++)->move = (x) | ( (SqSet[to] & (check) ) ? FLAG_CHECK : 0) \
< | ( HISTORY[pi][to] << 16); }
< #endif
---
> | ( HISTORY_PI_TO (POSITION, (pi), (to)) << 16); }
88d81
< #ifdef MULTIPLE_POS_GAIN
90c83
< { int v = ( (int) MAX_POSITIONAL_GAIN[POSITION->cpu][pi][(x) & 07777]); \
---
> { int v = ( (int) MAX_POS_GAIN ((pi), (x) & 07777)); \
92,97d84
< #else
< #define AddGain(L, x, pi, to) \
< { int v = ( (int) MAX_POSITIONAL_GAIN[pi][(x) & 07777]); \
< if (v >= av) (L++)->move = (x) | (v << 16); }
< #endif
<
108c95
< if ( move<q->move ) (q - 1)->move = q->move; \
---
> if ( move < q->move ) (q - 1)->move = q->move; \
150c137
< EVADE[king][sq]) & (~MyOccupied) & c2;
---
> Evade (king, sq)) & (~MyOccupied) & c2;
156c143
< mask = mask & (PIECE_IS_OPP_PAWN (pi) | EVADE[king][sq]);
---
> mask = mask & (PIECE_IS_OPP_PAWN (pi) | Evade (king, sq));
162c149
< c2 &= INTERPOSE[king][sq];
---
> c2 &= InterPose (king, sq);
diff 999953/pawn_eval.c 999952/pawn_eval.c
11c11
< } typePAWNptr;
---
> } typePAWNptr; /* 24 + 56 + 2 = 82 bytes */
diff 999953/pawn_eval_explain.c 999952/pawn_eval_explain.c
224c224
< AttPb[b] & AttK[bKs] ? '*' : ' ', OpEg (PieceSquareValue[wEnumP][b]));
---
> AttPb[b] & AttK[bKs] ? '*' : ' ', OpEg (PST (wEnumP, b)));
429c429
< AttPw[b] & AttK[wKs] ? '*' : ' ', OpEg (PieceSquareValue[bEnumP][b]));
---
> AttPw[b] & AttK[wKs] ? '*' : ' ', OpEg (PST (bEnumP, b)));
diff 999953/pv_node.c 999952/pv_node.c
317,319c317
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/qsearch.c 999952/qsearch.c
298,300c298
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/qsearch_pv.c 999952/qsearch_pv.c
374,376c374
< if (POS0->reversible == 100) /* HACK */
< v = 0;
< else if (IS_EXACT (POSITION->DYN->exact))
---
> if (IS_EXACT (POSITION->DYN->exact))
diff 999953/root_analysis.c 999952/root_analysis.c
55c55,56
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
138c139,140
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
diff 999953/root_multipv.c 999952/root_multipv.c
49a50,51
> #define CHECK_HALT_MULTI() { if (IVAN_ALL_HALT || POSITION->stop) goto UNDO_LABEL; }
>
84c86,87
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
128a132
> CHECK_HALT_MULTI ();
166a171
> CHECK_HALT_MULTI ();
177a183
> CHECK_HALT_MULTI ();
189a196
> CHECK_HALT_MULTI ();
195a203
> CHECK_HALT_MULTI ();
200a209,210
> if (IVAN_ALL_HALT)
> break;
207a218
> UNDO_LABEL:
218c229,230
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
diff 999953/root_node.c 999952/root_node.c
52c52,53
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
123c124,125
< else NODES = ROOT_POSIZIONE0->nodes;
---
> else
> NODES = ROOT_POSIZIONE0->nodes;
diff 999953/search.c 999952/search.c
284c284,287
< IncrementAge ();
---
> if (FIXED_AGE_ANALYSIS && ANALYSING)
> AGE = 0;
> else
> IncrementAge ();
diff 999953/set_position.c 999952/set_position.c
366c366,367
< if (I[0] == 'm')
---
> POSITION->StackHeight = 0; /* BUG fix */
> if (J && I[0] == 'm') /* BUG fix */
diff 999953/static.c 999952/static.c
5c5
< int sq;
---
> int sq, pi;
7,22c7,8
< {
< PieceSquareValue[bEnumP][sq] =
< -PieceSquareValue[wEnumP][H8 - sq];
< PieceSquareValue[bEnumN][sq] =
< -PieceSquareValue[wEnumN][H8 - sq];
< PieceSquareValue[bEnumBL][sq] =
< -PieceSquareValue[wEnumBL][H8 - sq];
< PieceSquareValue[bEnumBD][sq] =
< -PieceSquareValue[wEnumBD][H8 - sq];
< PieceSquareValue[bEnumR][sq] =
< -PieceSquareValue[wEnumR][H8 - sq];
< PieceSquareValue[bEnumQ][sq] =
< -PieceSquareValue[wEnumQ][H8 - sq];
< PieceSquareValue[bEnumK][sq] =
< -PieceSquareValue[wEnumK][H8 - sq];
< }
---
> for (pi = bEnumP; pi <= bEnumQ; pi++)
> PST (pi, sq) = -PST (pi - 8, H8 - sq);
128,130c114
< PieceSquareValue[wEnumP][sq] = COMBINE (ValueOpenP (sq), ValueEndP (sq));
< for (sq = A1; sq <= H8; sq++)
< PieceSquareValue[wEnumN][sq] = COMBINE (ValueOpenN (sq), ValueEndN (sq));
---
> PST (wEnumP, sq) = COMBINE (ValueOpenP (sq), ValueEndP (sq));
132c116
< PieceSquareValue[wEnumBL][sq] = COMBINE (ValueOpenB (sq), ValueEndB (sq));
---
> PST (wEnumN, sq) = COMBINE (ValueOpenN (sq), ValueEndN (sq));
134c118
< PieceSquareValue[wEnumBD][sq] = COMBINE (ValueOpenB (sq), ValueEndB (sq));
---
> PST (wEnumBL, sq) = PST (wEnumBD, sq) = COMBINE (ValueOpenB (sq), ValueEndB (sq));
136c120
< PieceSquareValue[wEnumR][sq] = COMBINE (ValueOpenR (sq), ValueEndR (sq));
---
> PST (wEnumR, sq) = COMBINE (ValueOpenR (sq), ValueEndR (sq));
138c122
< PieceSquareValue[wEnumQ][sq] = COMBINE (ValueOpenQ (sq), ValueEndQ (sq));
---
> PST (wEnumQ, sq) = COMBINE (ValueOpenQ (sq), ValueEndQ (sq));
140c124
< PieceSquareValue[wEnumK][sq] = COMBINE (ValueOpenK (sq), ValueEndK (sq));
---
> PST (wEnumK, sq) = COMBINE (ValueOpenK (sq), ValueEndK (sq));
diff 999953/utility.c 999952/utility.c
50,51c50,51
< POSITION->DYN->STATIC += PieceSquareValue[pi][i];
< POSITION->DYN->HASH ^= ZOBRIST[pi][i];
---
> POSITION->DYN->STATIC += PST (pi, i);
> POSITION->DYN->HASH ^= Zobrist (pi, i);
53c53
< POSITION->DYN->PAWN_HASH ^= ZOBRIST[pi][i];
---
> POSITION->DYN->PAWN_HASH ^= Zobrist (pi, i);
133c133
< ZOBRIST[wEnumK][POSITION->wKsq] ^ ZOBRIST[bEnumK][POSITION->bKsq];
---
> Zobrist (wEnumK, POSITION->wKsq) ^ Zobrist(bEnumK, POSITION->bKsq);
diff 999953/validate.c 999952/validate.c
27,28c27,28
< STATICO += PieceSquareValue[pez][sq];
< zZOBRIST ^= ZOBRIST[pez][sq];
---
> STATICO += PST (pez, sq);
> zZOBRIST ^= Zobrist (pez, sq);
30c30
< ZOBRIST_PEDONE ^= ZOBRIST[pez][sq];
---
> ZOBRIST_PEDONE ^= Zobrist (pez, sq);
71,72c71,72
< ZOBRIST_PEDONE ^= ZOBRIST[wEnumK][POSITION->wKsq] ^
< ZOBRIST[bEnumK][POSITION->bKsq];
---
> ZOBRIST_PEDONE ^=
> Zobrist (wEnumK, POSITION->wKsq) ^ Zobrist (bEnumK, POSITION->bKsq);
PAWN : Knight >> Bishop >> Rook >>Queen
Re: IvanHoe 999952 beta
From my testing fire1.31 wins almost every game against ivan53. hopefully 52 has some elo improvement. When will the ZOG thing be done?
- kingliveson
- Posts: 1388
- Joined: Thu Jun 10, 2010 1:22 am
- Real Name: Franklin Titus
- Location: 28°32'1"N 81°22'33"W
Re: IvanHoe 999952 beta
Get your feet wet overnight tournaments
Phenom II x4
Athlon 64 x2 6000+
Speed decrease in 999953/999952 stems from new ZUGZWANG_DETECT -- disabled and the nps rises.
Linux/Windows builds are available: http://chess.cygnitec.com/engine/
Phenom II x4
Code: Select all
IvanHoe vs Rybka, 0001 Blitz:1'
1 Deep Rybka 4 SSE42 x64 +12/=27/-11 51.00% 25.5/50
2 IvanHoe 9.52b x64 +11/=27/-12 49.00% 24.5/50
Code: Select all
Ivanhoe v Rybka R0001, Blitz:5' 2010
1 Deep Rybka 4 x64 +13/=29/-8 55.00% 27.5/50
2 IvanHoe 9.52b x64 +8/=29/-13 45.00% 22.5/50
Linux/Windows builds are available: http://chess.cygnitec.com/engine/
PAWN : Knight >> Bishop >> Rook >>Queen
- kingliveson
- Posts: 1388
- Joined: Thu Jun 10, 2010 1:22 am
- Real Name: Franklin Titus
- Location: 28°32'1"N 81°22'33"W
Re: IvanHoe 999952 beta
Re: 1-2% speed hit since introduction of Magic bitboard and ZUGZWANG_DETECT in version 9999953 >> 999952. The cause is new ZUGZWANG_DETECT. #undef ZUGZWANG_DETECT gives back the speed. Sacrificing a little speed for better results in this case is probably a good idea.
A performance profiling comparing #if 0 to #if 1 for a better picture of pre/post 999953:
Off
On
Off
On
Off
On
Code: Select all
#if 1
#define MAGIC_BITBOARDS
#define ZUGZWANG_DETECT
#define ONE_DIMENSIONAL
#define SLAB_MEMORY /* 1% slower w/o LARGE_PAGES, 2% faster with LARGE_PAGES */
#endif
Off
On
Off
On
Off
On
PAWN : Knight >> Bishop >> Rook >>Queen
Re: IvanHoe 999952 beta
52 with largepages on and with the recommended hash settings appears to be around +33 bayeselo above a stock version 52 with default settings which is with no largepages. This new largepages and slab memory code may be a real drag if largepages and proper hash settings are not activated. [testing done on linux box]
kingliveson wrote:Re: 1-2% speed hit since introduction of Magic bitboard and ZUGZWANG_DETECT in version 9999953 >> 999952. The cause is new ZUGZWANG_DETECT. #undef ZUGZWANG_DETECT gives back the speed. Sacrificing a little speed for better results in this case is probably a good idea.
A performance profiling comparing #if 0 to #if 1 for a better picture of pre/post 999953:Code: Select all
#if 1 #define MAGIC_BITBOARDS #define ZUGZWANG_DETECT #define ONE_DIMENSIONAL #define SLAB_MEMORY /* 1% slower w/o LARGE_PAGES, 2% faster with LARGE_PAGES */ #endif
Off
On
Off
On
Off
On