http://code.google.com/p/gray-matter/source/detail?r=1612
Modified:
/trunk/inc/bitboard.h
/trunk/inc/config.h
/trunk/src/board_base.cpp
=======================================
--- /trunk/inc/bitboard.h Wed Jul 28 22:54:14 2010
+++ /trunk/inc/bitboard.h Fri Jul 30 11:17:03 2010
@@ -22,6 +22,8 @@
#ifndef BITBOARD_H
#define BITBOARD_H
+#include <iostream>
+
// Default Gray Matter stuff:
#include "config.h"
#include "library.h"
@@ -50,31 +52,48 @@
public:
bitboard_t hashes[MAX_MOVES_PER_GAME];
unsigned mNumElements;
- inline bitBoardArray()
+
+ inline bitBoardArray()
{
mNumElements = 0;
}
- inline unsigned size() const
+
+ inline unsigned size() const
{
return mNumElements;
}
- inline void addHash(const bitboard_t& hash)
- {
- hashes[mNumElements] = hash;
- mNumElements++;
- }
- inline void clear()
+
+ inline void addHash(const bitboard_t& hash)
+ {
+ hashes[mNumElements] = hash;
+ mNumElements++;
+ }
+
+ inline void output()
+ {
+ std::cout << "outputting hashes:" << std::endl;
+ for (int i=0;i<mNumElements;++i)
+ {
+ std::cout << std::hex << hashes[i] << std::endl;
+ }
+ }
+
+ inline void clear()
{
mNumElements = 0;
}
- inline void removeLast()
+
+ inline void removeLast()
{
mNumElements--;
}
+
inline bitBoardArray& operator=(const bitBoardArray& rhs)
{
for(unsigned i=0;i<rhs.mNumElements;++i)
+ {
hashes[i] = rhs.hashes[i];
+ }
mNumElements = rhs.mNumElements;
return *this;
}
=======================================
--- /trunk/inc/config.h Sat Jul 25 16:06:03 2009
+++ /trunk/inc/config.h Fri Jul 30 11:17:03 2010
@@ -24,8 +24,6 @@
#include <windows.h>
#endif
-
-
// This file contains user-tunable settings for Gray Matter. If you don't
know
// what you're doing, then leave this file alone. The defaults are good
enough
// for me, so they're more than good enough for you. ;-)
=======================================
--- /trunk/src/board_base.cpp Fri Jul 30 09:41:31 2010
+++ /trunk/src/board_base.cpp Fri Jul 30 11:17:03 2010
@@ -678,7 +678,6 @@
BIT_SET(state.piece[ON_MOVE][shape], m.x2, m.y2);
for (int angle = L45; angle <= R90; angle++)
{
- BIT_CLR(rotation[angle][ON_MOVE],
coord[MAP][angle][m.x1][m.y1][X], coord[MAP][angle][m.x1][m.y1][Y]);
BIT_SET(rotation[angle][ON_MOVE],
coord[MAP][angle][m.x2][m.y2][X], coord[MAP][angle][m.x2][m.y2][Y]);
}
hash ^= key_piece[ON_MOVE][shape][m.x1][m.y1];
@@ -1756,7 +1755,6 @@
\*----------------------------------------------------------------------------*/
bool board_base::check(bitboard_t b1, bool color) const
{
-
/// Is any of the specified squares being attacked by the specified color?
/// Check for check. ;-)
@@ -1866,14 +1864,17 @@
bool board_base::three() const
{
/// Is the game drawn by threefold repetition?
+
int sum = 1;
- for (unsigned i=0;i<hashes.mNumElements;++i)
- if (hashes.hashes[i] == hash)
- sum++;
+ for (unsigned i=0;i<hashes.mNumElements;++i)
+ {
+ if (hashes.hashes[i] == hash)
+ sum++;
if (sum >= 3)
- return true;
- return false;
+ return true;
+ }
+ return false;
}
/*----------------------------------------------------------------------------*\