eval_progress.cc
Go to the documentation of this file.
#include "osl/eval/progress.h"
osl::CArray<int, 256> osl::eval::ml::ProgressBonus::table;
int osl::eval::ml::ProgressBonus::eval(Progress16 black,
Progress16 white)
{
return table[index(black, white)];
}
void osl::eval::ml::ProgressBonus::setUp(const Weights &weights)
{
for (size_t i = 0; i < weights.dimension(); ++i)
{
table[i] = weights.value(i);
}
for (int black = 0; black < 16; ++black)
{
for (int white = 0; white < 16; ++white)
{
if (black <= white)
{
table[index(Progress16(black), Progress16(white))] =
-table[index(Progress16(white), Progress16(black))];
}
}
}
}
␌
osl::CArray<int, 256> osl::eval::ml::ProgressAttackDefense::table;
int osl::eval::ml::ProgressAttackDefense::eval(
Progress16 black_attack, Progress16 white_defense,
Progress16 white_attack, Progress16 black_defense)
{
return table[index(black_attack, white_defense)] -
table[index(white_attack, black_defense)];
}
void osl::eval::ml::
ProgressAttackDefense::setUp(const Weights &weights)
{
for (size_t i = 0; i < weights.dimension(); ++i)
{
table[i] = weights.value(i);
}
}
␌
osl::CArray<int, 65536>
osl::eval::ml::ProgressAttackDefenseAll::table;
int osl::eval::ml::ProgressAttackDefenseAll::eval(
Progress16 black_attack, Progress16 white_defense,
Progress16 white_attack, Progress16 black_defense)
{
return table[index(black_attack, white_defense,
white_attack, black_defense)];
}
void osl::eval::ml::
ProgressAttackDefenseAll::setUp(const Weights &weights)
{
for (size_t i = 0; i < weights.dimension(); ++i)
{
table[i] = weights.value(i);
}
for (int ba = 0; ba < 16; ++ba)
{
for (int wd = 0; wd < 16; ++wd)
{
for (int wa = 0; wa < 16; ++wa)
{
for (int bd = 0; bd < 16; ++bd)
{
if (ba + wd < wa + bd ||
(ba + wd == wa + bd &&
ba <= wa))
{
table[index(Progress16(ba), Progress16(wd),
Progress16(wa), Progress16(bd))] =
-table[index(Progress16(wa), Progress16(bd),
Progress16(ba), Progress16(wd))];
}
}
}
}
}
}
osl::CArray
Definition container.h:20
osl::eval::ml::ProgressAttackDefenseAll::table
static CArray< int, 65536 > table
Definition eval/progress.h:57
osl::eval::ml::ProgressAttackDefenseAll::setUp
static void setUp(const Weights &weights)
Definition eval_progress.cc:64
osl::eval::ml::ProgressAttackDefenseAll::index
static int index(Progress16 black_attack, Progress16 white_defense, Progress16 white_attack, Progress16 black_defense)
Definition eval/progress.h:50
osl::eval::ml::ProgressAttackDefenseAll::eval
static int eval(Progress16 black_attack, Progress16 white_defense, Progress16 white_attack, Progress16 black_defense)
Definition eval_progress.cc:55
osl::eval::ml::ProgressAttackDefense::table
static CArray< int, 256 > table
Definition eval/progress.h:38
osl::eval::ml::ProgressAttackDefense::index
static int index(Progress16 attack, Progress16 defense)
Definition eval/progress.h:34
osl::eval::ml::ProgressAttackDefense::eval
static int eval(Progress16 black_attack, Progress16 white_defense, Progress16 white_attack, Progress16 black_defense)
Definition eval_progress.cc:34
osl::eval::ml::ProgressAttackDefense::setUp
static void setUp(const Weights &weights)
Definition eval_progress.cc:43
osl::eval::ml::ProgressBonus::table
static CArray< int, 256 > table
Definition eval/progress.h:24
osl::eval::ml::ProgressBonus::eval
static int eval(Progress16 black, Progress16 white)
Definition eval_progress.cc:5
osl::eval::ml::ProgressBonus::setUp
static void setUp(const Weights &weights)
Definition eval_progress.cc:11
osl::eval::ml::ProgressBonus::index
static int index(Progress16 black, Progress16 white)
Definition eval/progress.h:20
progress.h
osl::progress::Progress16
ProgressN< 16 > Progress16
Definition progress.h:42
osl::eval::ml::Weights
Definition weights.h:18
osl::eval::ml::Weights::dimension
size_t dimension() const
Definition weights.h:29
osl::eval::ml::Weights::value
int value(size_t index) const
Definition weights.h:27