moveInfo.h
Go to the documentation of this file.
00001 /* moveInfo.h
00002  */
00003 #ifndef OSL_MOVE_PROBABILITY_MOVEINFO_H
00004 #define OSL_MOVE_PROBABILITY_MOVEINFO_H
00005 
00006 #include "osl/state/numEffectState.h"
00007 #include "osl/pieceStand.h"
00008 namespace osl
00009 {
00010   namespace move_probability
00011   {
00012     struct StateInfo;
00013     struct MoveInfo
00014     {
00015       Move move;
00016       int see, plain_see;
00017       bool check, open_check;
00018       Player player;
00019       mutable int stand_index_cache;
00020       MoveInfo(const StateInfo&, Move);
00021 
00022       int standIndex(const NumEffectState& state) const
00023       {
00024         if (stand_index_cache < 0) {
00025           stand_index_cache = 0;
00026           assert(PieceStand::order[6] == PAWN);
00027           for (size_t i=0; i+1<PieceStand::order.size(); ++i) {
00028             Ptype ptype = PieceStand::order[i];
00029             int count = state.countPiecesOnStand(player, ptype);
00030             if (move.isDrop() && ptype == move.ptype())
00031               --count;
00032             stand_index_cache = stand_index_cache * 2 + (count > 0);
00033           }
00034         }
00035         return stand_index_cache;
00036       }
00037       bool adhocAdjustSlider(const StateInfo&) const;
00038       bool adhocAdjustBishopFork(const StateInfo&) const;
00039       bool adhocAdjustBreakThreatmate(const StateInfo&) const;
00040       bool adhocAdjustAttackCheckmateDefender(const StateInfo&) const;
00041       bool adhocAdjustKeepCheckmateDefender(const StateInfo&) const;
00042     };
00043   }
00044 }
00045 
00046 #endif /* OSL_MOVE_PROBABILITY_MOVEINFO_H */
00047 // ;;; Local Variables:
00048 // ;;; mode:c++
00049 // ;;; c-basic-offset:2
00050 // ;;; End:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines