captureEstimation.h
Go to the documentation of this file.
00001 /* captureEstimation.h
00002  */
00003 #ifndef _MOVE_ORDER_CAPTUREESTIMATION_H
00004 #define _MOVE_ORDER_CAPTUREESTIMATION_H
00005 
00006 #include "osl/move_order/promotion.h"
00007 #include "osl/state/numEffectState.h"
00008 #include "osl/eval/pieceEval.h"
00009 namespace osl
00010 {
00011   namespace move_order
00012   {
00013     struct CaptureEstimation
00014     {
00015       const NumEffectState& state;
00016       explicit CaptureEstimation(const NumEffectState& s) : state(s)
00017       {
00018       }
00019       bool operator()(Move l, Move r) const
00020       {
00021         const Ptype capture_ptype_l = l.capturePtype();
00022         const Ptype capture_ptype_r = r.capturePtype();
00023 
00024         const Ptype old_ptype_l = l.oldPtype();
00025         const Ptype old_ptype_r = r.oldPtype();
00026 
00027         const Player turn = l.player();
00028         
00029         int value_l = eval::Ptype_Eval_Table.value(capture_ptype_l);
00030         if (state.hasEffectAt(alt(turn), l.to()))
00031           value_l -= eval::Ptype_Eval_Table.value(old_ptype_l);
00032         int value_r = eval::Ptype_Eval_Table.value(capture_ptype_r);
00033         if (state.hasEffectAt(alt(turn), r.to()))
00034           value_r -= eval::Ptype_Eval_Table.value(old_ptype_r);
00035         
00036         // 実入の大きそうな手から指す
00037         if (value_l != value_r)
00038           return value_l > value_r;
00039 
00040         // 成る手から読む
00041         return Promotion()(l, r);
00042       }
00043     };
00044   } // namespace move_order
00045 } // namespace osl
00046 
00047 
00048 #endif /* _MOVE_ORDER_CAPTUREESTIMATION_H */
00049 // ;;; Local Variables:
00050 // ;;; mode:c++
00051 // ;;; c-basic-offset:2
00052 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines