osl::eval::ml::PiecePair Class Reference

`#include <piecePair.h>`

## Classes

struct | IndexTable

## Public Types

enum | { plain_table_size = 1338 , x_table_size = 4901 , y_table_size = 7057 , DIM = plain_table_size + x_table_size + y_table_size }
typedef CArray< int, 3 > | index_t

## Static Public Member Functions

static int | eval (const NumEffectState &, const Weights &)
template<int Direction, int Offset>
static int | sum12One (const Piece *basePtr, const int *xbase, const int *ybase)
static int | sum12 (NumEffectState const &state, Square base, PtypeO ptypeO)
template<int Direction, int Offset>
static int | adjust12One (const Piece *basePtr, const int *xbase1, const int *ybase1, const int *xbase2, const int *ybase2)
static int | adjust12 (NumEffectState const &state, Square base, PtypeO pos, PtypeO neg)
static int | evalWithUpdate (const NumEffectState &state, Move moved, int last_value, const Weights &values)
static int | evalWithUpdateCompiled (const NumEffectState &state, Move moved, int last_value)
static int | pieceValue (const NumEffectState &state, Piece p, const Weights &values)
static int | pieceValueDouble (const NumEffectState &state, Piece p, const Weights &)
static int | weight (Player attack, int index, const Weights &values)
static index_t | index (int offset_id, Piece p, Piece q)
static index_t | index (int offset_id, Square p0, PtypeO o0, Square p1, PtypeO o1)
static int | value (int offset_id, Piece p, Piece q, const Weights &values)
static int | value (int offset_id, Piece p, Square p1, PtypeO o1, const Weights &values)
static int | value (int offset_id, Square p0, PtypeO o0, Square p1, PtypeO o1, const Weights &values)
static void | init ()
static void | sanitize (Weights &values)
static void | compile (const Weights &values)
| values を展開してクラス全体で使う
static int | valueCompiled (int offset_id, Piece p, Square p1, PtypeO o1)
static int | valueCompiled (int offset_id, Square p0, PtypeO o0, Square p1, PtypeO o1)

## Static Public Attributes

static IndexTable | plain_table
static CArray< IndexTable, 10 > | x_table
static CArray< IndexTable, 10 > | y_table
static const CArray< Offset, 12 > | offsets

## Detailed Description

Definition at line 17 of file piecePair.h.

## Member Typedef Documentation

## index_t

typedef CArray<int,3> osl::eval::ml::PiecePair::index_t

Definition at line 44 of file piecePair.h.

## Member Enumeration Documentation

## anonymous enum

anonymous enum

Enumerator
plain_table_size |
x_table_size |
y_table_size |
DIM |

Definition at line 20 of file piecePair.h.

## Member Function Documentation

## adjust12()

int osl::eval::ml::PiecePair::adjust12 | ( | NumEffectState const & | state,
|  | Square | base,
|  | PtypeO | pos,
|  | PtypeO | neg )

inline static

Definition at line 571 of file piecePair.cc.

References adjust12One(), osl::SimpleState::getPiecePtr(), osl::ptypeOIndex(), osl::Square::x(), osl::eval::ml::ppair::x_values, osl::Square::y(), and osl::eval::ml::ppair::y_values.

Referenced by evalWithUpdateCompiled().

## adjust12One()

template<int Direction, int Offset>

int osl::eval::ml::PiecePair::adjust12One | ( | const Piece * | basePtr,
|  | const int * | xbase1,
|  | const int * | ybase1,
|  | const int * | xbase2,
|  | const int * | ybase2 )

inline static

Definition at line 559 of file piecePair.cc.

References osl::Piece::ptypeO(), osl::eval::ml::ppair::x_values, and osl::eval::ml::ppair::y_values.

Referenced by adjust12().

## compile()

void osl::eval::ml::PiecePair::compile | ( | const Weights & | values | ) |

static

values を展開してクラス全体で使う

Definition at line 364 of file piecePair.cc.

References offsets, plain_table, osl::PTYPEO_SIZE, osl::eval::ml::Weights::value(), x_table, osl::eval::ml::ppair::x_values, y_table, and osl::eval::ml::ppair::y_values.

Referenced by osl::eval::ml::OpenMidEndingEval::doResetWeights().

## eval()

int osl::eval::ml::PiecePair::eval | ( | const NumEffectState & | state,
|  | const Weights & | values )

static

Definition at line 449 of file piecePair.cc.

References osl::SimpleState::pieceOf(), pieceValueDouble(), and osl::Piece::SIZE.

Referenced by osl::eval::ml::OpenMidEndingEval::OpenMidEndingEval().

## evalWithUpdate()

int osl::eval::ml::PiecePair::evalWithUpdate | ( | const NumEffectState & | state,
|  | Move | moved,
|  | int | last_value,
|  | const Weights & | values )

static

Definition at line 460 of file piecePair.cc.

References osl::Move::capturePtypeO(), osl::Move::from(), osl::Offset::index(), osl::Move::isCapture(), osl::Move::isPass(), osl::Piece::isPiece(), osl::Square::isPieceStand(), osl::eval::ml::ppair::offset_index, offsets, osl::Move::oldPtypeO(), osl::SimpleState::pieceAt(), osl::Move::ptypeO(), osl::Piece::square(), osl::Move::to(), and value().

## evalWithUpdateCompiled()

int osl::eval::ml::PiecePair::evalWithUpdateCompiled | ( | const NumEffectState & | state,
|  | Move | moved,
|  | int | last_value )

static

Definition at line 594 of file piecePair.cc.

References adjust12(), osl::Move::capturePtypeO(), osl::Move::from(), osl::Offset::index(), osl::Move::isCapture(), osl::Square::isPieceStand(), osl::eval::ml::ppair::offset_index, osl::Move::oldPtypeO(), osl::Move::ptypeO(), osl::ptypeOIndex(), sum12(), osl::Move::to(), osl::Square::x(), osl::eval::ml::ppair::x_values, osl::Square::y(), and osl::eval::ml::ppair::y_values.

Referenced by osl::eval::ml::OpenMidEndingEval::updateSub().

## index() [1/2]

osl::eval::ml::PiecePair::index_t osl::eval::ml::PiecePair::index | ( | int | offset_id,
|  | Piece | p,
|  | Piece | q )

static

Definition at line 439 of file piecePair.cc.

References index(), osl::Piece::isOnBoard(), osl::Piece::isPiece(), osl::Piece::ptypeO(), and osl::Piece::square().

Referenced by osl::eval::ml::PiecePair::IndexTable::fillBW(), osl::eval::ml::PiecePair::IndexTable::fillDiffer(), osl::eval::ml::PiecePair::IndexTable::fillSame(), index(), sanitize(), value(), and weight().

## index() [2/2]

osl::eval::ml::PiecePair::index_t osl::eval::ml::PiecePair::index | ( | int | offset_id,
|  | Square | p0,
|  | PtypeO | o0,
|  | Square | p1,
|  | PtypeO | o1 )

static

Definition at line 419 of file piecePair.cc.

References osl::Square::isPieceStand(), offsets, plain_table, plain_table_size, osl::ptypeOIndex(), osl::Square::x(), x_table, x_table_size, osl::Square::y(), y_table, and y_table_size.

## init()

void osl::eval::ml::PiecePair::init | ( |  | ) |

static

Definition at line 351 of file piecePair.cc.

References osl::eval::ml::ppair::makeOffsetIndex(), osl::eval::ml::ppair::makeTable(), osl::eval::ml::ppair::makeTableX(), and osl::eval::ml::ppair::makeTableY().

Referenced by osl::eval::ml::OpenMidEndingEval::doResetWeights().

## pieceValue()

int osl::eval::ml::PiecePair::pieceValue | ( | const NumEffectState & | state,
|  | Piece | p,
|  | const Weights & | values )

static

Definition at line 668 of file piecePair.cc.

References pieceValueDouble().

## pieceValueDouble()

int osl::eval::ml::PiecePair::pieceValueDouble | ( | const NumEffectState & | state,
|  | Piece | p,
|  | const Weights & | values )

static

Definition at line 649 of file piecePair.cc.

References osl::Piece::isOnBoard(), osl::Piece::isPiece(), osl::Square::isPieceStand(), offsets, osl::SimpleState::pieceAt(), osl::Piece::square(), and value().

Referenced by eval(), and pieceValue().

## sanitize()

void osl::eval::ml::PiecePair::sanitize | ( | Weights & | values | ) |

static

Definition at line 395 of file piecePair.cc.

References osl::BLACK, index(), osl::Square::isOnBoard(), osl::isPiece(), osl::newPtypeO(), offsets, osl::PTYPE_MAX, osl::PTYPE_PIECE_MIN, osl::eval::ml::Weights::setValue(), and osl::WHITE.

Referenced by osl::eval::ml::OpenMidEndingEval::doResetWeights().

## sum12()

int osl::eval::ml::PiecePair::sum12 | ( | NumEffectState const & | state,
|  | Square | base,
|  | PtypeO | ptypeO )

inline static

Definition at line 537 of file piecePair.cc.

References osl::SimpleState::getPiecePtr(), osl::ptypeOIndex(), sum12One(), osl::Square::x(), osl::eval::ml::ppair::x_values, osl::Square::y(), and osl::eval::ml::ppair::y_values.

Referenced by evalWithUpdateCompiled().

## sum12One()

template<int Direction, int Offset>

int osl::eval::ml::PiecePair::sum12One | ( | const Piece * | basePtr,
|  | const int * | xbase,
|  | const int * | ybase )

inline static

Definition at line 528 of file piecePair.cc.

References osl::Piece::ptypeO(), osl::eval::ml::ppair::x_values, and osl::eval::ml::ppair::y_values.

Referenced by sum12().

## value() [1/3]

int osl::eval::ml::PiecePair::value | ( | int | offset_id,
|  | Piece | p,
|  | Piece | q,
|  | const Weights & | values )

inline static

Definition at line 48 of file piecePair.h.

References osl::Piece::isOnBoard(), osl::Piece::ptypeO(), osl::Piece::square(), and value().

Referenced by evalWithUpdate(), pieceValueDouble(), value(), and value().

## value() [2/3]

int osl::eval::ml::PiecePair::value | ( | int | offset_id,
|  | Piece | p,
|  | Square | p1,
|  | PtypeO | o1,
|  | const Weights & | values )

inline static

Definition at line 53 of file piecePair.h.

References osl::Piece::ptypeO(), osl::Piece::square(), and value().

## value() [3/3]

int osl::eval::ml::PiecePair::value | ( | int | offset_id,
|  | Square | p0,
|  | PtypeO | o0,
|  | Square | p1,
|  | PtypeO | o1,
|  | const Weights & | values )

inline static

Definition at line 57 of file piecePair.h.

References index(), and osl::eval::ml::Weights::value().

## valueCompiled() [1/2]

int osl::eval::ml::PiecePair::valueCompiled | ( | int | offset_id,
|  | Piece | p,
|  | Square | p1,
|  | PtypeO | o1 )

inline static

Definition at line 72 of file piecePair.h.

References osl::Piece::ptypeO(), osl::Piece::square(), and valueCompiled().

Referenced by valueCompiled().

## valueCompiled() [2/2]

int osl::eval::ml::PiecePair::valueCompiled | ( | int | offset_id,
|  | Square | p0,
|  | PtypeO | o0,
|  | Square | p1,
|  | PtypeO | o1 )

static

Definition at line 516 of file piecePair.cc.

References osl::Square::isPieceStand(), offsets, osl::ptypeOIndex(), osl::Square::x(), osl::eval::ml::ppair::x_values, osl::Square::y(), and osl::eval::ml::ppair::y_values.

## weight()

int osl::eval::ml::PiecePair::weight | ( | Player | attack,
|  | int | index,
|  | const Weights & | values )

inline static

Definition at line 40 of file piecePair.h.

References osl::eval::delta(), index(), and osl::eval::ml::Weights::value().

## Member Data Documentation

## offsets

const osl::CArray< osl::Offset, 12 > osl::eval::ml::PiecePair::offsets

static

Initial value:
= {
DirectionPlayerTraits<UUL, BLACK>::offset(),
DirectionPlayerTraits<UL, BLACK>::offset(),
DirectionPlayerTraits<L, BLACK>::offset(),
DirectionPlayerTraits<DL, BLACK>::offset(),
DirectionPlayerTraits<UUR, WHITE>::offset(),
DirectionPlayerTraits<D, BLACK>::offset(),
DirectionPlayerTraits<UUL, WHITE>::offset(),
DirectionPlayerTraits<DR, BLACK>::offset(),
DirectionPlayerTraits<R, BLACK>::offset(),
DirectionPlayerTraits<UR, BLACK>::offset(),
DirectionPlayerTraits<UUR, BLACK>::offset(),
DirectionPlayerTraits<U, BLACK>::offset(),
}
osl::DirectionPlayerTraits
Definition directionTraits.h:242

Definition at line 8 of file piecePair.h.

Referenced by osl::eval::ml::PiecePair::IndexTable::amplify(), compile(), evalWithUpdate(), index(), osl::eval::ml::ppair::makeOffsetIndex(), osl::eval::ml::ppair::makeTableX(), osl::eval::ml::ppair::makeTableY(), pieceValueDouble(), sanitize(), and valueCompiled().

## plain_table

osl::eval::ml::PiecePair::IndexTable osl::eval::ml::PiecePair::plain_table

static

Definition at line 93 of file piecePair.h.

Referenced by compile(), and index().

## x_table

osl::CArray< osl::eval::ml::PiecePair::IndexTable, 10 > osl::eval::ml::PiecePair::x_table

static

Definition at line 94 of file piecePair.h.

Referenced by compile(), and index().

## y_table

osl::CArray< osl::eval::ml::PiecePair::IndexTable, 10 > osl::eval::ml::PiecePair::y_table

static

Definition at line 94 of file piecePair.h.

Referenced by compile(), and index().

The documentation for this class was generated from the following files:

- piecePair.h
- piecePair.cc