diff -Naur ../../old/glaurung22/src/Makefile ./Makefile --- ../../old/glaurung22/src/Makefile 2008-05-14 07:36:28.000000000 -0400 +++ ./Makefile 2009-02-10 22:08:02.000000000 -0500 @@ -26,7 +26,7 @@ OBJS = bitboard.o color.o pawns.o material.o endgame.o evaluate.o main.o \ misc.o move.o movegen.o history.o movepick.o search.o piece.o \ position.o square.o direction.o tt.o value.o uci.o ucioption.o \ - mersenne.o book.o bitbase.o san.o benchmark.o + mersenne.o book.o bitbase.o san.o benchmark.o types.o ### diff -Naur ../../old/glaurung22/src/bitboard.cpp ./bitboard.cpp --- ../../old/glaurung22/src/bitboard.cpp 2008-12-20 11:10:26.000000000 -0500 +++ ./bitboard.cpp 2009-02-10 22:03:50.000000000 -0500 @@ -399,7 +399,7 @@ void init_ray_bitboards() { int d[8] = {1, -1, 16, -16, 17, -17, 15, -15}; - for(int i = 0; i < 128; i = i + 9 & ~8) { + for(int i = 0; i < 128; i = (i + 9) & ~8) { for(int j = 0; j < 8; j++) { RayBB[(i&7)|((i>>4)<<3)][j] = EmptyBoardBB; for(int k = i + d[j]; (k & 0x88) == 0; k += d[j]) diff -Naur ../../old/glaurung22/src/material.cpp ./material.cpp --- ../../old/glaurung22/src/material.cpp 2008-12-19 17:39:38.000000000 -0500 +++ ./material.cpp 2009-02-10 21:58:58.000000000 -0500 @@ -192,7 +192,7 @@ MaterialInfo *MaterialInfoTable::get_material_info(const Position &pos) { Key key = pos.get_material_key(); - int index = key & (size - 1); + int index = key.getInt() & (size - 1); MaterialInfo *mi = entries + index; // If mi->key matches the position's material hash key, it means that we diff -Naur ../../old/glaurung22/src/pawns.cpp ./pawns.cpp --- ../../old/glaurung22/src/pawns.cpp 2008-12-19 17:39:37.000000000 -0500 +++ ./pawns.cpp 2009-02-10 21:58:58.000000000 -0500 @@ -172,7 +172,7 @@ assert(pos.is_ok()); Key key = pos.get_pawn_key(); - int index = int(key & (size - 1)); + int index = int(key.getInt() & (size - 1)); PawnInfo *pi = entries + index; // If pi->key matches the position's pawn hash key, it means that we diff -Naur ../../old/glaurung22/src/position.cpp ./position.cpp --- ../../old/glaurung22/src/position.cpp 2008-12-19 17:39:37.000000000 -0500 +++ ./position.cpp 2009-02-10 21:58:58.000000000 -0500 @@ -1790,7 +1790,7 @@ /// to verify the correctness of the hash key when running in debug mode. Key Position::compute_key() const { - Key result = Key(0ULL); + Key result; //zero initializer for(Square s = SQ_A1; s <= SQ_H8; s++) if(this->square_is_occupied(s)) @@ -1813,7 +1813,7 @@ /// debug mode. Key Position::compute_pawn_key() const { - Key result = Key(0ULL); + Key result;// = Key(0ULL); Bitboard b; Square s; @@ -1835,7 +1835,7 @@ /// debug mode. Key Position::compute_material_key() const { - Key result = Key(0ULL); + Key result;// = Key(0ULL); for(Color c = WHITE; c <= BLACK; c++) for(PieceType pt = PAWN; pt <= QUEEN; pt++) { int count = this->piece_count(c, pt); @@ -2000,23 +2000,23 @@ for(int i = 0; i < 2; i++) for(int j = 0; j < 8; j++) for(int k = 0; k < 64; k++) - zobrist[i][j][k] = Key(genrand_int64()); + zobrist[i][j][k] = gen_rand_key(); for(int i = 0; i < 64; i++) - zobEp[i] = Key(genrand_int64()); + zobEp[i] = gen_rand_key(); for(int i = 0; i < 16; i++) - zobCastle[i] = genrand_int64(); + zobCastle[i] = gen_rand_key(); - zobSideToMove = genrand_int64(); + zobSideToMove = gen_rand_key(); for(int i = 0; i < 2; i++) for(int j = 0; j < 8; j++) for(int k = 0; k < 16; k++) - zobMaterial[i][j][k] = (k > 0)? Key(genrand_int64()) : Key(0LL); + zobMaterial[i][j][k] = (k > 0)? gen_rand_key() : Key(); for(int i = 0; i < 16; i++) - zobMaterial[0][KING][i] = zobMaterial[1][KING][i] = Key(0ULL); + zobMaterial[0][KING][i] = zobMaterial[1][KING][i] = Key(); } diff -Naur ../../old/glaurung22/src/search.cpp ./search.cpp --- ../../old/glaurung22/src/search.cpp 2008-12-20 11:10:40.000000000 -0500 +++ ./search.cpp 2009-02-10 22:00:02.000000000 -0500 @@ -180,7 +180,8 @@ // Time managment variables int SearchStartTime; - int MaxNodes, MaxDepth; + int64_t MaxNodes; + int MaxDepth; int MaxSearchTime, AbsoluteMaxSearchTime, ExtraSearchTime; Move BestRootMove, PonderMove, EasyMove; int RootMoveNumber; @@ -297,7 +298,7 @@ /// search-related global variables, and calls root_search() void think(const Position &pos, bool infinite, bool ponder, int time, - int increment, int movesToGo, int maxDepth, int maxNodes, + int increment, int movesToGo, int maxDepth, int64_t maxNodes, int maxTime, Move searchMoves[]) { // Look for a book move: diff -Naur ../../old/glaurung22/src/search.h ./search.h --- ../../old/glaurung22/src/search.h 2008-12-19 17:39:41.000000000 -0500 +++ ./search.h 2009-02-10 22:00:02.000000000 -0500 @@ -81,7 +81,7 @@ extern void init_threads(); extern void stop_threads(); extern void think(const Position &pos, bool infinite, bool ponder, int time, - int increment, int movesToGo, int maxDepth, int maxNodes, + int increment, int movesToGo, int maxDepth, int64_t maxNodes, int maxTime, Move searchMoves[]); extern int64_t nodes_searched(); diff -Naur ../../old/glaurung22/src/tt.cpp ./tt.cpp --- ../../old/glaurung22/src/tt.cpp 2008-12-19 17:39:37.000000000 -0500 +++ ./tt.cpp 2009-02-10 21:58:58.000000000 -0500 @@ -100,7 +100,7 @@ Move m, ValueType type) { TTEntry *tte, *replace; - tte = replace = entries + int(pos.get_key() & (size - 1)) * 4; + tte = replace = entries + int(pos.get_key().getInt() & (size - 1)) * 4; for(int i = 0; i < 4; i++) { if((tte+i)->key() == pos.get_key()) { if(m == MOVE_NONE) @@ -133,7 +133,7 @@ TTEntry *tte; bool found = false; - tte = entries + int(pos.get_key() & (size - 1)) * 4; + tte = entries + int(pos.get_key().getInt() & (size - 1)) * 4; for(int i = 0; i < 4 && !found ; i++) if((tte+i)->key() == pos.get_key()) { tte = tte + i; diff -Naur ../../old/glaurung22/src/tt.h ./tt.h --- ../../old/glaurung22/src/tt.h 2008-12-19 17:39:41.000000000 -0500 +++ ./tt.h 2009-02-10 22:02:44.000000000 -0500 @@ -75,7 +75,7 @@ private: unsigned size; - int writes; + unsigned long long writes; TTEntry* entries; uint8_t generation; }; diff -Naur ../../old/glaurung22/src/types.cpp ./types.cpp --- ../../old/glaurung22/src/types.cpp 1969-12-31 19:00:00.000000000 -0500 +++ ./types.cpp 2009-02-10 21:58:58.000000000 -0500 @@ -0,0 +1,4 @@ +#include "types.h" +std::ostream& operator<<(std::ostream &os, Key x){ + return (os << x.v1 << " " << x.v2 ); +} diff -Naur ../../old/glaurung22/src/types.h ./types.h --- ../../old/glaurung22/src/types.h 2008-12-19 17:39:41.000000000 -0500 +++ ./types.h 2009-02-10 21:58:58.000000000 -0500 @@ -36,8 +36,58 @@ typedef unsigned long long uint64_t; #endif // !defined(_MSC_VER) +#include // Hash keys: -typedef uint64_t Key; +//typedef uint64_t Key; +class Key { + uint64_t v1; + uint32_t v2; + friend bool operator==(Key,Key); + friend bool operator!=(Key,Key); + friend Key operator^(Key,Key); + friend Key operator&(Key,Key); + friend void operator^=(Key&,Key); + friend Key gen_rand_key(); + friend std::ostream& operator<<(std::ostream &, const Key); + Key(const uint64_t m1, const uint32_t m2) : v1(m1),v2(m2) {} + public: + uint64_t getInt() const { + return v1; + } + Key() :v1(0),v2(0) {} // hope this doesnt get called too often + + +}; + +uint64_t genrand_int64(void); +uint32_t genrand_int32(void); +inline Key gen_rand_key(){ + //i hope this does unsigned + return Key(genrand_int64(),genrand_int32()); +} + +inline bool operator== (Key x, Key y) { + return (x.v1==y.v1)&&(x.v2==y.v2); +} +//short circuit OR makes faster that not and +inline bool operator!= (Key x, Key y) { + return (x.v1!=y.v1)||(x.v2!=y.v2); +} + +inline Key operator^(Key x,Key y) { + return Key(x.v1^y.v1,x.v2^y.v2); +} + +inline Key operator&(Key x,Key y) { + return Key(x.v1&y.v1,x.v2&y.v2); +} + +inline void operator^=(Key &x, Key y){ + x.v1^=y.v1; + x.v2^=y.v2; +} + + #endif // !defined(TYPES_H_INCLUDED) diff -Naur ../../old/glaurung22/src/uci.cpp ./uci.cpp --- ../../old/glaurung22/src/uci.cpp 2008-12-19 17:39:37.000000000 -0500 +++ ./uci.cpp 2009-02-10 22:00:02.000000000 -0500 @@ -324,7 +324,8 @@ void go(UCIInputParser &uip) { std::string token; - int time[2] = {0, 0}, inc[2] = {0, 0}, movesToGo = 0, depth = 0, nodes = 0; + int time[2] = {0, 0}, inc[2] = {0, 0}, movesToGo = 0, depth = 0; + int64_t nodes = 0; int moveTime = 0; bool infinite = false, ponder = false; Move searchMoves[500]; @@ -364,7 +365,7 @@ } else if(token == "nodes") { if(!uip.at_end_of_line()) - nodes = atoi(uip.get_next_token().c_str()); + nodes = atoll(uip.get_next_token().c_str()); } else if(token == "movetime") { if(!uip.at_end_of_line())