My Project
proofPiecesUtil.h
Go to the documentation of this file.
1 /* proofPiecesUtil.h
2  */
3 #ifndef OSL_PROOFPIECESUTIL_H
4 #define OSL_PROOFPIECESUTIL_H
5 
6 #include "osl/numEffectState.h"
7 
8 namespace osl
9 {
10  namespace checkmate
11  {
12  class CheckMoveList;
17  {
22  static
23  void addMonopolizedPieces(const SimpleState& state, Player player,
24  const PieceStand max, PieceStand& out)
25  {
26  const Player opponent = alt(player);
27  for (Ptype ptype: PieceStand::order)
28  {
29  if (! state.hasPieceOnStand(opponent, ptype))
30  {
31  const int diff = max.get(ptype) - out.get(ptype);
32  assert(diff >= 0);
33  if (diff)
34  out.add(ptype, diff);
35  }
36  }
37  }
38  };
39  } // namespace checkmate
40 } // osl
41 
42 #endif /* OSL_PROOFPIECESUTIL_H */
43 // ;;; Local Variables:
44 // ;;; mode:c++
45 // ;;; c-basic-offset:2
46 // ;;; End:
osl::alt
constexpr Player alt(Player player)
Definition: basic_type.h:13
osl::SimpleState
Definition: simpleState.h:35
osl::Ptype
Ptype
駒の種類を4ビットでコード化する
Definition: basic_type.h:84
osl::eval::max
int max(Player p, int v1, int v2)
Definition: evalTraits.h:84
checkmate
osl::PieceStand
片方の手番の持駒の枚数を記録するクラス.
Definition: bits/pieceStand.h:38
osl::checkmate::ProofPiecesUtil
ProofPieces と DisproofPieces に共通の関数
Definition: proofPiecesUtil.h:17
osl::PieceStand::add
void add(Ptype type, unsigned int num=1)
Definition: bits/pieceStand.h:68
osl::PieceStand::order
static const CArray< Ptype, 7 > order
持駒の表示で良く使われる順番.
Definition: bits/pieceStand.h:41
osl::SimpleState::hasPieceOnStand
bool hasPieceOnStand(Player player, Ptype ptype) const
Definition: simpleState.h:191
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
osl::Player
Player
Definition: basic_type.h:8
numEffectState.h
osl::PieceStand::get
unsigned int get(Ptype type) const
Definition: bits/pieceStand.h:131
osl
Definition: additionalEffect.h:6