All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
captureEstimation.h
Go to the documentation of this file.
1 /* captureEstimation.h
2  */
3 #ifndef _MOVE_ORDER_CAPTUREESTIMATION_H
4 #define _MOVE_ORDER_CAPTUREESTIMATION_H
5 
8 #include "osl/eval/pieceEval.h"
9 namespace osl
10 {
11  namespace move_order
12  {
14  {
15  const NumEffectState& state;
16  explicit CaptureEstimation(const NumEffectState& s) : state(s)
17  {
18  }
19  bool operator()(Move l, Move r) const
20  {
21  const Ptype capture_ptype_l = l.capturePtype();
22  const Ptype capture_ptype_r = r.capturePtype();
23 
24  const Ptype old_ptype_l = l.oldPtype();
25  const Ptype old_ptype_r = r.oldPtype();
26 
27  const Player turn = l.player();
28 
29  int value_l = eval::Ptype_Eval_Table.value(capture_ptype_l);
30  if (state.hasEffectAt(alt(turn), l.to()))
31  value_l -= eval::Ptype_Eval_Table.value(old_ptype_l);
32  int value_r = eval::Ptype_Eval_Table.value(capture_ptype_r);
33  if (state.hasEffectAt(alt(turn), r.to()))
34  value_r -= eval::Ptype_Eval_Table.value(old_ptype_r);
35 
36  // 実入の大きそうな手から指す
37  if (value_l != value_r)
38  return value_l > value_r;
39 
40  // 成る手から読む
41  return Promotion()(l, r);
42  }
43  };
44  } // namespace move_order
45 } // namespace osl
46 
47 
48 #endif /* _MOVE_ORDER_CAPTUREESTIMATION_H */
49 // ;;; Local Variables:
50 // ;;; mode:c++
51 // ;;; c-basic-offset:2
52 // ;;; End: