All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kingOpenMove.cc
Go to the documentation of this file.
3 
4 template <osl::Player P>
5 template <bool hasException>
7 isMemberMain(const NumEffectState& state, Ptype, Square from, Square to,
8  Square exceptFor)
9 {
10  assert(! from.isPieceStand());
11  Square king_position=state.template kingSquare<P>();
12  if (king_position.isPieceStand())
13  return false;
17  assert(king_position != from);
21  Offset offset=Board_Table.getShortOffsetNotKnight(Offset32(king_position,from));
26  if(offset.zero() ||
27  offset==Board_Table.getShortOffsetNotKnight(Offset32(king_position,to)))
28  return false;
29  if(!state.isEmptyBetween(from,king_position,offset,true)) return false;
30  Square pos=from;
31  Piece p;
32  for(pos-=offset;;pos-=offset){
33  // TODO: exceptFor を毎回チェックする必要があるのはoffset方向の時だけ
34  if (! ((hasException && (pos == exceptFor))
35  || (p=state.pieceAt(pos), p.isEmpty())))
36  break;
37  assert(pos.isOnBoard());
38  }
44  return false;
45  return Ptype_Table.getEffect(p.ptypeO(),pos,king_position).hasEffect();
46 }
47 
48 namespace osl
49 {
50  // explicit template instantiation
53 
54  template bool move_classifier::KingOpenMove<BLACK>::isMemberMain<true>(const NumEffectState&, Ptype,Square,Square,Square);
55  template bool move_classifier::KingOpenMove<BLACK>::isMemberMain<false>(const NumEffectState&, Ptype,Square,Square,Square);
56  template bool move_classifier::KingOpenMove<WHITE>::isMemberMain<true>(const NumEffectState&, Ptype,Square,Square,Square);
57  template bool move_classifier::KingOpenMove<WHITE>::isMemberMain<false>(const NumEffectState&, Ptype,Square,Square,Square);
58 }
59 
60 // ;;; Local Variables:
61 // ;;; mode:c++
62 // ;;; c-basic-offset:2
63 // ;;; End: