All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
effect_util/pin.cc
Go to the documentation of this file.
1 /* pin.cc
2  */
3 #include "osl/effect_util/pin.h"
4 
5 #ifndef MINIMAL
6 osl::PieceMask osl::effect_util::
7 Pin::makeNaive(const SimpleState& state, Square target,
8  Player defense)
9 {
10  assert(target.isOnBoard());
11  PieceMask result;
12  findDirection<UL>(state, target, defense, result);
13  findDirection<U>(state, target, defense, result);
14  findDirection<UR>(state, target, defense, result);
15  findDirection<L>(state, target, defense, result);
16  findDirection<R>(state, target, defense, result);
17  findDirection<DL>(state, target, defense, result);
18  findDirection<D>(state, target, defense, result);
19  findDirection<DR>(state, target, defense, result);
20  return result;
21 }
22 
23 osl::PieceMask osl::effect_util::
24 Pin::makeByPiece(const NumEffectState& state, Square target,
25  Player defense)
26 {
27  assert(target.isOnBoard());
28  const Player attack = alt(defense);
29  PieceMask result;
30  // 香車
31  findDirection<U>(state, target, defense, result);
32  // 飛車 角
33  findPtype<ROOK>(state, target, attack, defense, result);
34  findPtype<BISHOP>(state, target, attack, defense, result);
35  return result;
36 }
37 
38 osl::PieceMask osl::effect_util::
39 Pin::makeByPieceKing(const NumEffectState& state, Square target,
40  Player defense)
41 {
42  assert(target.isOnBoard());
43  const Player attack = alt(defense);
44  PieceMask result;
45  // 香車
46  if(defense==BLACK){
47  findLance<BLACK>(state, target, result);
48  }
49  else{
50  findLance<WHITE>(state, target, result);
51  }
52  // 飛車 角
53  findPtype<ROOK>(state, target, attack, defense, result);
54  findPtype<BISHOP>(state, target, attack, defense, result);
55  return result;
56 }
57 #endif
58 
59 /* ------------------------------------------------------------------------- */
60 // ;;; Local Variables:
61 // ;;; mode:c++
62 // ;;; c-basic-offset:2
63 // ;;; coding:utf-8
64 // ;;; End: