My Project
std
osl
pathEncoding.cc
Go to the documentation of this file.
1
/* pathEncoding.cc
2
*/
3
#include "
osl/pathEncoding.h
"
4
#include "
osl/random.h
"
5
#include "
osl/oslConfig.h
"
6
#include <iostream>
7
8
osl::PathEncodingTable
osl::Path_Encoding_Table
;
9
10
namespace
11
{
12
namespace
PathEncoding
{
13
osl::SetUpRegister
_initializer
([](){
osl::Path_Encoding_Table
.
init
(); });
14
}
15
}
16
17
void
osl::PathEncodingTable::
18
init
()
19
{
20
for
(
size_t
i=0; i<
MaxEncodingLength
; ++i)
21
{
22
for
(
size_t
j=0; j<
Square::SIZE
; ++j)
23
{
24
for
(
int
k=0; k<
PTYPE_SIZE
; ++k)
25
{
26
const
unsigned
long
long
h = random();
27
const
unsigned
int
l = random();
28
assert(l);
29
assert(h << 32);
30
// 手番を表現するため下位1bitをあけておく
31
values
[i][j][k] = (h << 32) + (l & (~1u));
32
}
33
}
34
}
35
}
36
37
#if (!defined MINIMAL ) || (defined DFPNSTATONE)
38
std::ostream&
osl::operator<<
(std::ostream& os,
const
osl::PathEncoding
& path)
39
{
40
os << std::hex << path.
getPath
() << std::dec <<
" "
<< path.
getDepth
();
41
return
os;
42
}
43
#endif
44
/* ------------------------------------------------------------------------- */
45
// ;;; Local Variables:
46
// ;;; mode:c++
47
// ;;; c-basic-offset:2
48
// ;;; 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::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
Generated by
1.9.8