mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Simplify init_safety()
In this for is also ready to be tuned....to be continued ;-) No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
7f095b0a36
commit
1288a5a10a
1 changed files with 6 additions and 15 deletions
|
@ -1104,28 +1104,19 @@ namespace {
|
||||||
|
|
||||||
void init_safety() {
|
void init_safety() {
|
||||||
|
|
||||||
int maxSlope = 30;
|
const Value MaxSlope = Value(30);
|
||||||
int peak = 0x500;
|
const Value Peak = Value(1280);
|
||||||
double a = 0.4;
|
|
||||||
double b = 0.0;
|
|
||||||
Value t[100];
|
Value t[100];
|
||||||
|
|
||||||
// First setup the base table
|
// First setup the base table
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
if (i < b)
|
t[i] = Value(int(0.4 * i * i));
|
||||||
t[i] = Value(0);
|
|
||||||
else
|
|
||||||
t[i] = Value((int)(a * (i - b) * (i - b)));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < 100; i++)
|
if (i > 0)
|
||||||
{
|
t[i] = Min(t[i], t[i - 1] + MaxSlope);
|
||||||
if (t[i] - t[i - 1] > maxSlope)
|
|
||||||
t[i] = t[i - 1] + Value(maxSlope);
|
|
||||||
|
|
||||||
if (t[i] > Value(peak))
|
t[i] = Min(t[i], Peak);
|
||||||
t[i] = Value(peak);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then apply the weights and get the final KingDangerTable[] array
|
// Then apply the weights and get the final KingDangerTable[] array
|
||||||
|
|
Loading…
Add table
Reference in a new issue