All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
proofPieces.h
Go to the documentation of this file.
1 /* proofPieces.h
2  */
3 #ifndef _PROOFPIECES_H
4 #define _PROOFPIECES_H
5 
8 namespace osl
9 {
10  namespace checkmate
11  {
12  class CheckMoveList;
13  struct ProofPieces
14  {
15  static const PieceStand leaf(const NumEffectState& state,
16  Player attacker, const PieceStand max)
17  {
18  assert(state.turn() != attacker);
20  if (! effect_util::UnblockableCheck::isMember(alt(attacker), state))
21  ProofPiecesUtil::addMonopolizedPieces(state, attacker, max, result);
22  return result;
23  }
24  static const PieceStand
25  attack(const PieceStand prev, Move move, const PieceStand max)
26  {
27  assert(move.isValid());
28  PieceStand result = prev;
29  if (move.isDrop())
30  {
31  const Ptype ptype = move.ptype();
32  if (result.get(ptype) < max.get(ptype))
33  result.add(ptype);
34  }
35  else
36  {
37  const Ptype captured = move.capturePtype();
38  if (isPiece(captured))
39  {
40  const Ptype ptype = unpromote(captured);
41  result.trySub(ptype);
42  }
43  }
44  return result;
45  }
46  static const PieceStand
47  defense(const CheckMoveList& moves, const NumEffectState& state,
48  PieceStand max);
49  };
50 
51  } // namespace checkmate
52 } // osl
53 
54 #endif /* _PROOFPIECES_H */
55 // ;;; Local Variables:
56 // ;;; mode:c++
57 // ;;; c-basic-offset:2
58 // ;;; End: