forked from hoshir/zebra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprobcut.c
133 lines (105 loc) · 2.8 KB
/
probcut.c
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
File: probcut.c
Created: March 1, 1998
Modified: November 24, 2002
Author: Gunnar Andersson ([email protected])
Contents: The initialization of the Multi-ProbCut search parameters.
*/
#include "porting.h"
#include <math.h>
#include "constant.h"
#include "epcstat.h"
#include "pcstat.h"
#include "probcut.h"
/* Global variables */
int use_end_cut[61];
int end_mpc_depth[61][4];
DepthInfo mpc_cut[MAX_CUT_DEPTH + 1];
/*
SET_PROBCUT
Specifies that searches to depth DEPTH are to be
estimated using searches to depth SHALLOW_DEPTH.
*/
static void
set_probcut( int depth, int shallow ) {
int i;
int this_try;
this_try = mpc_cut[depth].cut_tries;
mpc_cut[depth].cut_depth[this_try] = shallow;
for ( i = 0; i <= 60; i++ ) {
mpc_cut[depth].bias[this_try][i] =
floor( 128.0 * (mid_corr[i][shallow].const_base +
mid_corr[i][shallow].const_slope * shallow) );
mpc_cut[depth].window[this_try][i] =
floor( 128.0 * (mid_corr[i][shallow].sigma_base +
mid_corr[i][shallow].sigma_slope * shallow) );
}
mpc_cut[depth].cut_tries++;
}
/*
SET_END_PROBCUT
Specifies that endgame searches with EMPTY empty disks
are to be estimated using searches to depth SHALLOW_DEPTH.
*/
static void
set_end_probcut( int empty, int shallow_depth ) {
int stage;
stage = 60 - empty;
if ( shallow_depth <= MAX_CORR_DEPTH )
if ( end_stats_available[stage][shallow_depth] )
end_mpc_depth[stage][use_end_cut[stage]++] = shallow_depth;
}
/*
INIT_PROBCUT
Clears the tables with MPC information and chooses some
reasonable cut pairs.
*/
void
init_probcut( void ) {
int i;
for ( i = 0; i <= MAX_CUT_DEPTH; i++ )
mpc_cut[i].cut_tries = 0;
for ( i = 0; i <= 60; i++ )
use_end_cut[i] = 0;
set_probcut( 3, 1 );
set_probcut( 4, 2 );
set_probcut( 5, 1 );
set_probcut( 6, 2 );
set_probcut( 7, 3 );
set_probcut( 8, 4 );
set_probcut( 9, 3 );
set_probcut( 10, 4 );
set_probcut( 10, 6 );
set_probcut( 11, 3 );
set_probcut( 11, 5 );
set_probcut( 12, 4 );
set_probcut( 12, 6 );
set_probcut( 13, 5 );
set_probcut( 13, 7 );
set_probcut( 14, 6 );
set_probcut( 14, 8 );
set_probcut( 15, 5 );
set_probcut( 15, 7 );
set_probcut( 16, 6 );
set_probcut( 16, 8 );
set_probcut( 17, 5 );
set_probcut( 17, 7 );
set_probcut( 18, 6 );
set_probcut( 18, 8 );
set_probcut( 20, 8 );
set_end_probcut( 13, 1 );
set_end_probcut( 14, 1 );
set_end_probcut( 15, 2 );
set_end_probcut( 16, 2 );
set_end_probcut( 17, 2 );
set_end_probcut( 18, 2 );
set_end_probcut( 19, 3 );
set_end_probcut( 20, 3 );
set_end_probcut( 21, 4 );
set_end_probcut( 22, 4 );
set_end_probcut( 23, 4 );
set_end_probcut( 24, 4 );
set_end_probcut( 25, 4 );
set_end_probcut( 26, 4 );
set_end_probcut( 27, 4 );
}