summaryrefslogtreecommitdiffstats
path: root/kenolaba/EvalScheme.h
blob: 3a9982c5e9da5e7414f2572a55df3f289c610795 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
 * EvalScheme
 *
 * Configuration options for a Evaluation Scheme.
 * Evaluation Schemes are used for evalution of a Abalone board position
 *
 * (C) JW, 2000
 */

#ifndef _EVALSCHEME_H_
#define _EVALSCHEME_H_

#include <tqstring.h>

#include "Move.h"

class KConfig;

/*
 * The constructor gets a name, and tries to read the scheme
 * for the Kenolaba configuration file, if nothing found, use
 * default values
 */

class EvalScheme
{
 public:
  EvalScheme(TQString);
  EvalScheme(EvalScheme&);
  ~EvalScheme() {}

  void setDefaults();
  void read(KConfig*);
  void save(KConfig*);

  static EvalScheme* create(TQString);
  TQString ascii();

  void setName(TQString n) { _name = n; }
  void setRingValue(int ring, int value);
  void setRingDiff(int ring, int value);
  void setStoneValue(int stoneDiff, int value);
  void setMoveValue(int type, int value);
  void setInARowValue(int stones, int value);

  TQString name() { return _name; }
  int ringValue(int r) { return (r>=0 && r<5) ? _ringValue[r] : 0; }
  int ringDiff(int r) { return (r>0 && r<5) ? _ringDiff[r] : 0; }
  int stoneValue(int s) { return (s>0 && s<6) ? _stoneValue[s] : 0; }
  int moveValue(int t) { return (t>=0 && t<Move::typeCount) ? _moveValue[t] : 0;}
  int inARowValue(int s) { return (s>=0 && s<InARowCounter::inARowCount) ? _inARowValue[s]:0; }

 private:
  int _ringValue[5], _ringDiff[5];
  int _stoneValue[6], _moveValue[Move::none];
  int _inARowValue[InARowCounter::inARowCount];

  TQString _name;
};

#endif // _EVALSCHEME_H_