00001
00002
00003 #ifndef _APPLYMOVEWITHPATH_H
00004 #define _APPLYMOVEWITHPATH_H
00005
00006 #include "osl/apply_move/applyMove.h"
00007 #include "osl/pathEncoding.h"
00008 namespace osl
00009 {
00010 namespace apply_move
00011 {
00012 template<Player P>
00013 struct ApplyMoveWithPath
00014 {
00018 template <class State, class Function>
00019 static
00020 void doUndoMove(State& state, PathEncoding& path, Move move, Function& h)
00021 {
00022 assert(state.getTurn() == move.player());
00023 const PathEncoding old_path = path;
00024 path.pushMove(move);
00025 ApplyMove<P>::doUndoMove(state,move,h);
00026 path = old_path;
00027 }
00028 template <class State, class Function>
00029 static
00030 void doUndoMoveOrPass(State& state, PathEncoding& path, Move move, Function& h)
00031 {
00032 assert(state.getTurn() == move.player());
00033 const PathEncoding old_path = path;
00034 path.pushMove(move);
00035 ApplyMove<P>::doUndoMoveOrPass(state,move,h);
00036 path = old_path;
00037 }
00038 };
00039 }
00040 using apply_move::ApplyMoveWithPath;
00041 }
00042
00043
00044 #endif
00045
00046
00047
00048