My Project
boardTable.cc
Go to the documentation of this file.
1/* directionTable.cc
2 */
5
6template <osl::Direction Dir>
8 const int blackDx=DirectionTraits<Dir>::blackDx;
9 const int blackDy=DirectionTraits<Dir>::blackDy;
10 Offset offset=Offset(blackDx,blackDy);
11#ifndef MINIMAL
12 space_counts[Offset32Wide(0,0).index()]=0;
13#endif
14 for(int i=1;i<=8;i++){
15 int dx=i*blackDx;
16 int dy=i*blackDy;
17 Offset32 offset32(dx,dy);
18 directions[offset32.index()]=Dir;
19 short_offsets[offset32.index()]=offset;
20 short_offsets_not_knight[offset32.index()]=offset;
22 longToShort(Dir);
24 offset.intValue();
25 }
26#ifndef MINIMAL
27 for(int i=1;i<=10;i++){
28 int dx=i*blackDx;
29 int dy=i*blackDy;
30 Offset32Wide offset32w(dx,dy);
31 space_counts[offset32w.index()]=i-1;
32 }
33#endif
34}
35template <osl::Direction Dir>
39 Offset32 offset32=Offset32(dx,dy);
40 Offset offset=Offset(dx,dy);
41 short_offsets[offset32.index()]=offset;
42 short_offsets[(-offset32).index()]= -offset;
43}
44
46 short8Dir.fill(DIRECTION_INVALID_VALUE);
47 short8Offset.fill();
48 directions.fill();
49 short_offsets_not_knight.fill();
50#ifndef MINIMAL
51 space_counts.fill(-1);
52#endif
53 setDirections<LONG_UL>();
54 setDirections<LONG_U>();
55 setDirections<LONG_UR>();
56 setDirections<LONG_L>();
57 setDirections<LONG_R>();
58 setDirections<LONG_DL>();
59 setDirections<LONG_D>();
60 setDirections<LONG_DR>();
61 setKnightDirections<UUL>();
62 setKnightDirections<UUR>();
63}
64
66 init();
67 assert(! getOffset(BLACK, UL).zero());
68}
69
70/* ------------------------------------------------------------------------- */
71// ;;; Local Variables:
72// ;;; mode:c++
73// ;;; c-basic-offset:2
74// ;;; End:
CArray< Offset, Offset32::SIZE > short_offsets
Definition boardTable.h:18
void setKnightDirections()
Definition boardTable.cc:36
CArray< Offset, Offset32::SIZE > short_offsets_not_knight
Definition boardTable.h:19
CArray< int, Offset32Wide::SIZE > space_counts
Definition boardTable.h:21
CArray< Direction, Offset32::SIZE > directions
Definition boardTable.h:14
CArray< signed char, Offset::ONBOARD_OFFSET_SIZE > short8Offset
Definition boardTable.h:16
CArray< unsigned char, Offset::ONBOARD_OFFSET_SIZE > short8Dir
Definition boardTable.h:17
void setDirections()
Definition boardTable.cc:7
差が uniqになるような座標の差分.
Definition offset32.h:17
unsigned int index() const
Definition offset32.h:40
座標の差分
Definition basic_type.h:430
int intValue() const
Definition basic_type.h:448
Offset32Base< 10, 10 > Offset32Wide
Definition offset32.h:64
constexpr Direction longToShort(Direction d)
Definition basic_type.h:380
@ DIRECTION_INVALID_VALUE
Definition basic_type.h:338
Offset32Base< 8, 9 > Offset32
Definition offset32.h:63
@ BLACK
Definition basic_type.h:9