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 
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  {
25  {
26  public:
28  protected:
32  osl::stack<int> state_stack;
33  const osl::Move selectMoveAtRandom(const std::vector<osl::record::opening::WMove>& moves) const;
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 
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)
60  topn(topn)
61  {}
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: