allMoves.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
allMoves.h
Go to the documentation of this file.
1 #ifndef OSL_GENERATE_ALL_MOVES_H
2 #define OSL_GENERATE_ALL_MOVES_H
3 #include "osl/state/numEffectState.h"
4 #include "osl/misc/loki.h"
5 #include "osl/move_action/store.h"
6 #include "osl/move_action/concept.h"
7 #include "osl/container/moveVector.h"
8 #include <boost/static_assert.hpp>
9
10 namespace osl
11 {
12 namespace container
13 {
14 class MoveVector;
15 }
16 namespace move_generator
17 {
22 template<class Action>
23 class AllMoves
24 {
25 BOOST_CLASS_REQUIRE(Action,osl::move_action,Concept);
26 public:
32 template<Player P>
33 static void generateOnBoard(const NumEffectState& state, Action& action);
34
40 template<Player P>
41 static void generate(const NumEffectState& state, Action& action);
42
43 static void generate(Player p, const NumEffectState& state, Action& action)
44 {
45 if(p==BLACK)
46 generate<BLACK>(state,action);
47 else
48 generate<WHITE>(state,action);
49 }
50 };
51
52 } // namespace move_generator
53
54 struct GenerateAllMoves
55 {
56 static void generate(Player p, const NumEffectState& state, container::MoveVector&);
57 template <Player P>
58 static void generate(const NumEffectState& state, MoveVector& out)
59 {
60 typedef move_action::Store store_t;
61 store_t store(out);
62 move_generator::AllMoves<store_t>::generate<P>(state, store);
63 }
64 template <Player P>
65 static void generateOnBoard(const NumEffectState& state, MoveVector& out)
66 {
67 typedef move_action::Store store_t;
68 store_t store(out);
69 move_generator::AllMoves<store_t>::generateOnBoard<P>(state, store);
70 }
71 };
72 } // namespace osl
73
74 #endif /* OSL_GENERATE_ALL_MOVES_H */
75 // ;;; Local Variables:
76 // ;;; mode:c++
77 // ;;; c-basic-offset:2
78 // ;;; End: