weightTracer.h Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
weightTracer.h
Go to the documentation of this file.
1 /* winCountTracer.h
2 */
3 #ifndef GAME_PLAYING_WEIGHTTRACER_H
4 #define GAME_PLAYING_WEIGHTTRACER_H
5
6 #include "osl/game_playing/openingBookTracer.h"
7 #include "osl/record/opening/openingBook.h"
8 #include "osl/stl/stack.h"
9
10 namespace osl
11 {
12 namespace record
13 {
14 namespace opening
15 {
16 class WeightedBook;
17 }
18 }
19 namespace game_playing
20 {
24 class WeightTracer : public OpeningBookTracer
25 {
26 public:
27 typedef record::opening::WeightedBook WeightedBook;
28 protected:
29 WeightedBook& book;
30 int state_index, start_index;
31 Player turn;
32 osl::stack<int> state_stack;
33 const osl::Move selectMoveAtRandom(const std::vector<osl::record::opening::WMove>& moves) const;
34 const int weight_coef_for_the_initial_move;
35 const int weight_coef;
36 public:
37 explicit WeightTracer(WeightedBook&, bool verbose=false,
38 const int weight_coef_for_the_initial_move = 16,
39 const int weight_coef = 10);
40 WeightTracer(const WeightTracer&);
41 OpeningBookTracer* clone() const;
42
43 void update(Move);
44 const Move selectMove() const;
45
46 int stateIndex() const { return state_index; }
47 bool isOutOfBook() const;
48 void popMove();
49 };
50
51 class DeterminateWeightTracer : public WeightTracer
52 {
54 const int topn;
55 public:
56 explicit DeterminateWeightTracer(WeightedBook& book, bool verbose=false, const int topn=1,
57 const int weight_coef_for_the_initial_move = 16,
58 const int weight_coef = 10)
59 : WeightTracer(book, verbose, weight_coef_for_the_initial_move, weight_coef),
60 topn(topn)
61 {}
62 DeterminateWeightTracer(const DeterminateWeightTracer& copy)
63 : WeightTracer(copy), topn(copy.getTopn()) {}
64 OpeningBookTracer* clone() const;
65
66 const Move selectMove() const;
67 int getTopn() const {return topn;}
68 };
69
70 } // namespace game_playing
71 } // namespace osl
72
73 #endif // GAME_PLAYING_WEIGHTTRACER_H
74 // ;;; Local Variables:
75 // ;;; mode:c++
76 // ;;; c-basic-offset:2
77 // ;;; coding:utf-8
78 // ;;; End: