00001 /* pathEncoding.cc 00002 */ 00003 #include "osl/pathEncoding.h" 00004 #include "osl/random.h" 00005 #include "osl/oslConfig.h" 00006 #include <iostream> 00007 00008 osl::PathEncodingTable osl::Path_Encoding_Table; 00009 00010 static osl::SetUpRegister _initializer([](){ osl::Path_Encoding_Table.init(); }); 00011 00012 void osl::PathEncodingTable:: 00013 init() 00014 { 00015 for (size_t i=0; i<MaxEncodingLength; ++i) 00016 { 00017 for (size_t j=0; j<Square::SIZE; ++j) 00018 { 00019 for (int k=0; k<PTYPE_SIZE; ++k) 00020 { 00021 const unsigned long long h = random(); 00022 const unsigned int l = random(); 00023 assert(l); 00024 assert(h << 32); 00025 // 手番を表現するため下位1bitをあけておく 00026 values[i][j][k] = (h << 32) + (l & (~1u)); 00027 } 00028 } 00029 } 00030 } 00031 00032 #if (!defined MINIMAL ) || (defined DFPNSTATONE) 00033 std::ostream& osl::operator<<(std::ostream& os, const osl::PathEncoding& path) 00034 { 00035 os << std::hex << path.getPath() << std::dec << " " << path.getDepth(); 00036 return os; 00037 } 00038 #endif 00039 /* ------------------------------------------------------------------------- */ 00040 // ;;; Local Variables: 00041 // ;;; mode:c++ 00042 // ;;; c-basic-offset:2 00043 // ;;; End: