pathEncoding.cc
Go to the documentation of this file.
/* pathEncoding.cc
*/
#include "osl/pathEncoding.h"
#include "osl/random.h"
#include "osl/oslConfig.h"
#include <iostream>
osl::PathEncodingTable osl::Path_Encoding_Table;
namespace
{
namespace PathEncoding {
osl::SetUpRegister _initializer([](){ osl::Path_Encoding_Table.init(); });
}
}
void osl::PathEncodingTable::
init()
{
for (size_t i=0; i<MaxEncodingLength; ++i)
{
for (size_t j=0; j<Square::SIZE; ++j)
{
for (int k=0; k<PTYPE_SIZE; ++k)
{
const unsigned long long h = random();
const unsigned int l = random();
assert(l);
assert(h << 32);
// 手番を表現するため下位1bitをあけておく
values[i][j][k] = (h << 32) + (l & (~1u));
}
}
}
}
#if (!defined MINIMAL ) || (defined DFPNSTATONE)
std::ostream& osl::operator<<(std::ostream& os, const osl::PathEncoding& path)
{
os << std::hex << path.getPath() << std::dec << " " << path.getDepth();
return os;
}
#endif
/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
_initializer
static osl::SetUpRegister _initializer([](){ osl::Centering3x3::table.init();})
osl::PathEncodingTable
Definition pathEncoding.h:12
osl::PathEncodingTable::MaxEncodingLength
static const size_t MaxEncodingLength
Definition pathEncoding.h:14
osl::PathEncodingTable::values
array_t values
Definition pathEncoding.h:18
osl::PathEncodingTable::init
void init()
Definition pathEncoding.cc:18
osl::PathEncoding
Definition pathEncoding.h:40
osl::PathEncoding::getPath
unsigned long long getPath() const
Definition pathEncoding.h:69
osl::PathEncoding::getDepth
int getDepth() const
Definition pathEncoding.h:70
osl::Square::SIZE
@ SIZE
Definition basic_type.h:543
PathEncoding
Definition pathEncoding.cc:12
osl::PTYPE_SIZE
const int PTYPE_SIZE
Definition basic_type.h:107
osl::random
unsigned int random()
Definition random.cc:4
osl::Path_Encoding_Table
PathEncodingTable Path_Encoding_Table
Definition pathEncoding.cc:8
osl::operator<<
std::ostream & operator<<(std::ostream &os, Player player)
Definition basic_type.cc:14
oslConfig.h
pathEncoding.h
random.h
osl::SetUpRegister
Definition oslConfig.h:128