00001 /* takeBack.h 00002 */ 00003 #ifndef _TAKEBACK_H 00004 #define _TAKEBACK_H 00005 00006 #include "osl/category/categoryEnv.h" 00007 #include "osl/category/categoryTraits.h" 00008 #include "osl/category/probTable.h" 00009 #include "osl/move_generator/capture_.h" 00010 #include "osl/move_action/store.h" 00011 #include "osl/container/moveStack.h" 00012 00013 namespace osl 00014 { 00015 namespace category 00016 { 00020 struct TakeBack : public StandardProbabilityCategory 00021 { 00022 static Interpolator<PieceValueTable> probTable; 00023 static const char *getName() { return "TakeBack"; } 00024 static bool isEffective(const CategoryEnv& env) 00025 { 00026 return env.history->lastMove().isNormal(); 00027 } 00028 static bool isInCategory(const CategoryEnv& env, Move move) 00029 { 00030 return isEffective(env) 00031 && (env.history->lastMove().to() == move.to()); 00032 } 00033 static void generate(const CategoryEnv& env, MoveVector& out) 00034 { 00035 if (! isEffective(env)) 00036 return; 00037 move_action::Store store(out); 00038 move_generator::GenerateCapture:: 00039 generate(env.state->getTurn(), *env.state, 00040 env.history->lastMove().to(), store); 00041 } 00042 }; 00043 00044 } // namespace category 00045 } // namespace osl 00046 00047 #endif /* _TAKEBACK_H */ 00048 // ;;; Local Variables: 00049 // ;;; mode:c++ 00050 // ;;; c-basic-offset:2 00051 // ;;; End: