eval_progress.cc
Go to the documentation of this file.
1 #include "osl/eval/progress.h"
2 
4 
6  Progress16 white)
7 {
8  return table[index(black, white)];
9 }
10 
12 {
13  for (size_t i = 0; i < weights.dimension(); ++i)
14  {
15  table[i] = weights.value(i);
16  }
17 
18  for (int black = 0; black < 16; ++black)
19  {
20  for (int white = 0; white < 16; ++white)
21  {
22  if (black <= white)
23  {
24  table[index(Progress16(black), Progress16(white))] =
25  -table[index(Progress16(white), Progress16(black))];
26  }
27  }
28  }
29 }
30 
31 
33 
35  Progress16 black_attack, Progress16 white_defense,
36  Progress16 white_attack, Progress16 black_defense)
37 {
38  return table[index(black_attack, white_defense)] -
39  table[index(white_attack, black_defense)];
40 }
41 
42 void osl::eval::ml::
44 {
45  for (size_t i = 0; i < weights.dimension(); ++i)
46  {
47  table[i] = weights.value(i);
48  }
49 }
50 
51 
54 
56  Progress16 black_attack, Progress16 white_defense,
57  Progress16 white_attack, Progress16 black_defense)
58 {
59  return table[index(black_attack, white_defense,
60  white_attack, black_defense)];
61 }
62 
63 void osl::eval::ml::
65 {
66  for (size_t i = 0; i < weights.dimension(); ++i)
67  {
68  table[i] = weights.value(i);
69  }
70  for (int ba = 0; ba < 16; ++ba)
71  {
72  for (int wd = 0; wd < 16; ++wd)
73  {
74  for (int wa = 0; wa < 16; ++wa)
75  {
76  for (int bd = 0; bd < 16; ++bd)
77  {
78  if (ba + wd < wa + bd ||
79  (ba + wd == wa + bd &&
80  ba <= wa))
81  {
83  Progress16(wa), Progress16(bd))] =
84  -table[index(Progress16(wa), Progress16(bd),
85  Progress16(ba), Progress16(wd))];
86  }
87  }
88  }
89  }
90  }
91 }
static CArray< int, 256 > table
Definition: eval/progress.h:38
static void setUp(const Weights &weights)
static void setUp(const Weights &weights)
int value(size_t index) const
Definition: weights.h:27
ProgressN< 16 > Progress16
Definition: progress.h:42
static int eval(Progress16 black, Progress16 white)
Definition: eval_progress.cc:5
static CArray< int, 256 > table
Definition: eval/progress.h:24
static void setUp(const Weights &weights)
static int eval(Progress16 black_attack, Progress16 white_defense, Progress16 white_attack, Progress16 black_defense)
static int index(Progress16 black, Progress16 white)
Definition: eval/progress.h:20
static CArray< int, 65536 > table
Definition: eval/progress.h:57
static int eval(Progress16 black_attack, Progress16 white_defense, Progress16 white_attack, Progress16 black_defense)
size_t dimension() const
Definition: weights.h:29