proofPiecesUtil.h
Go to the documentation of this file.
/* proofPiecesUtil.h
*/
#ifndef OSL_PROOFPIECESUTIL_H
#define OSL_PROOFPIECESUTIL_H
#include "osl/numEffectState.h"
namespace osl
{
namespace checkmate
{
class CheckMoveList;
struct ProofPiecesUtil
{
static
void addMonopolizedPieces(const SimpleState& state, Player player,
const PieceStand max, PieceStand& out)
{
const Player opponent = alt(player);
for (Ptype ptype: PieceStand::order)
{
if (! state.hasPieceOnStand(opponent, ptype))
{
const int diff = max.get(ptype) - out.get(ptype);
assert(diff >= 0);
if (diff)
out.add(ptype, diff);
}
}
}
};
} // namespace checkmate
} // osl
#endif /* OSL_PROOFPIECESUTIL_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::PieceStand
片方の手番の持駒の枚数を記録するクラス.
Definition bits/pieceStand.h:38
osl::PieceStand::add
void add(Ptype type, unsigned int num=1)
Definition bits/pieceStand.h:68
osl::PieceStand::get
unsigned int get(Ptype type) const
Definition bits/pieceStand.h:131
osl::PieceStand::order
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
Definition bits/pieceStand.h:41
osl::SimpleState
Definition simpleState.h:35
osl::SimpleState::hasPieceOnStand
bool hasPieceOnStand(Player player, Ptype ptype) const
Definition simpleState.h:191
osl::checkmate
Definition king8Info.h:12
osl
Definition additionalEffect.h:6
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition basic_type.h:84
osl::Player
Player
Definition basic_type.h:8
osl::alt
constexpr Player alt(Player player)
Definition basic_type.h:13
numEffectState.h
osl::checkmate::ProofPiecesUtil
ProofPieces と DisproofPieces に共通の関数
Definition proofPiecesUtil.h:17
osl::checkmate::ProofPiecesUtil::addMonopolizedPieces
static void addMonopolizedPieces(const SimpleState &state, Player player, const PieceStand max, PieceStand &out)
alt(player) が持っていない種類の持駒を playerが持っていたら out に独占分を加算する．
Definition proofPiecesUtil.h:23