immediateCheckmateTable.h
Go to the documentation of this file.
/* immediateCheckmateTable.h
*/
#ifndef OSL_CHECKMATE_IMMEDIATE_CHECKMATE_TABLE_H
#define OSL_CHECKMATE_IMMEDIATE_CHECKMATE_TABLE_H
#include "osl/basic_type.h"
#include "osl/bits/king8Info.h"
namespace osl
{
namespace checkmate
{
class ImmediateCheckmateTable
{
private:
CArray<unsigned char,0x10000u> dropPtypeMasks;
CArray2d<unsigned char,0x100u,PTYPE_SIZE> ptypeDropMasks;
CArray2d<unsigned char,PTYPE_SIZE,8> blockingMasks;
CArray2d<unsigned short,PTYPE_SIZE,8> noEffectMasks;
public:
ImmediateCheckmateTable();
unsigned char dropPtypeMaskOf(unsigned int liberty_drop_mask) const
{
return dropPtypeMasks[liberty_drop_mask];
}
unsigned char dropPtypeMask(King8Info canMoveMask) const
{
return dropPtypeMaskOf(canMoveMask.libertyDropMask());
}
unsigned int ptypeDropMask(Ptype ptype,King8Info canMoveMask) const
{
return ptypeDropMasks[canMoveMask.liberty()][ptype];
}
unsigned int blockingMask(Ptype ptype,Direction dir) const
{
assert(static_cast<int>(dir)<8);
return blockingMasks[ptype][dir];
}
unsigned int noEffectMask(Ptype ptype,Direction dir) const
{
assert(static_cast<int>(dir)<8);
return noEffectMasks[ptype][dir];
}
};
extern const ImmediateCheckmateTable Immediate_Checkmate_Table;
}
}
#endif /* OSL_CHECKMATE_IMMEDIATE_CHECKMATE_TABLE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::CArray
Definition container.h:20
osl::checkmate::ImmediateCheckmateTable
Definition immediateCheckmateTable.h:13
osl::checkmate::ImmediateCheckmateTable::noEffectMasks
CArray2d< unsigned short, PTYPE_SIZE, 8 > noEffectMasks
Definition immediateCheckmateTable.h:18
osl::checkmate::ImmediateCheckmateTable::dropPtypeMasks
CArray< unsigned char, 0x10000u > dropPtypeMasks
Definition immediateCheckmateTable.h:15
osl::checkmate::ImmediateCheckmateTable::ptypeDropMask
unsigned int ptypeDropMask(Ptype ptype, King8Info canMoveMask) const
Definition immediateCheckmateTable.h:29
osl::checkmate::ImmediateCheckmateTable::ptypeDropMasks
CArray2d< unsigned char, 0x100u, PTYPE_SIZE > ptypeDropMasks
Definition immediateCheckmateTable.h:16
osl::checkmate::ImmediateCheckmateTable::dropPtypeMaskOf
unsigned char dropPtypeMaskOf(unsigned int liberty_drop_mask) const
Definition immediateCheckmateTable.h:21
osl::checkmate::ImmediateCheckmateTable::blockingMasks
CArray2d< unsigned char, PTYPE_SIZE, 8 > blockingMasks
Definition immediateCheckmateTable.h:17
osl::checkmate::ImmediateCheckmateTable::blockingMask
unsigned int blockingMask(Ptype ptype, Direction dir) const
Definition immediateCheckmateTable.h:33
osl::checkmate::ImmediateCheckmateTable::ImmediateCheckmateTable
ImmediateCheckmateTable()
Definition immediateCheckmateTable.cc:30
osl::checkmate::ImmediateCheckmateTable::dropPtypeMask
unsigned char dropPtypeMask(King8Info canMoveMask) const
Definition immediateCheckmateTable.h:25
osl::checkmate::ImmediateCheckmateTable::noEffectMask
unsigned int noEffectMask(Ptype ptype, Direction dir) const
Definition immediateCheckmateTable.h:38
osl::checkmate::King8Info
敵玉の8近傍の状態を表す.
Definition king8Info.h:29
osl::checkmate::King8Info::liberty
unsigned int liberty() const
8-15 bit 目を 0-7bitにshiftして返す
Definition king8Info.h:54
osl::checkmate::King8Info::libertyDropMask
unsigned int libertyDropMask() const
0-15bit
Definition king8Info.h:59
king8Info.h
osl::checkmate
Definition king8Info.h:12
osl::checkmate::Immediate_Checkmate_Table
const ImmediateCheckmateTable Immediate_Checkmate_Table
Definition tables.cc:122
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::CArray2d
CArray< CArray< T, Capacity2 >, Capacity1 > CArray2d
Definition container.h:95
osl::Direction
Direction
Definition basic_type.h:310