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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
Author: Lukas Geyer <lukas@debian.org>
Description: General code cleanup.
--- sjeng-11.2.orig/search.c
+++ sjeng-11.2/search.c
@@ -264,7 +264,7 @@
}
-long int qsearch (int alpha, int beta, int depth) {
+long int qsearch (long alpha, long beta, int depth) {
/* perform a quiscense search on the current node using alpha-beta with
negamax search */
@@ -275,9 +275,10 @@
move_ordering[MOVE_BUFF],
see_values[MOVE_BUFF];
bool legal_move, no_moves = TRUE;
- int sbest, best_score, best, delta, bound;
- int originalalpha;
- int oldtime;
+ long best_score, bound, delta;
+ int sbest, best;
+ long originalalpha;
+ long int oldtime;
int seev;
pv_length[ply] = ply;
@@ -301,7 +302,7 @@
extendedtime = 1;
oldtime = time_for_move;
time_for_move += allocate_time();
- printf("Extended from %d to %d, time left %d\n", oldtime,
+ printf("Extended from %ld to %ld, time left %ld\n", oldtime,
time_for_move,
time_left);
}
@@ -473,7 +474,7 @@
}
-long int search (int alpha, int beta, int depth, int is_null) {
+long int search (long alpha, long beta, int depth, int is_null) {
/* search the current node using alpha-beta with negamax search */
@@ -481,16 +482,18 @@
int num_moves, i, j;
long int score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF];
bool no_moves, legal_move;
- int bound, threat, donull, best, sbest, best_score, old_ep;
+ long int best_score, bound;
+ int threat, donull, best, sbest, old_ep;
bool incheck, first;
- int extend, fscore, fmax, selective;
+ long int fscore, fmax;
+ int extend, selective;
move_s kswap;
int ksswap;
- int originalalpha;
+ long originalalpha;
int afterincheck;
int legalmoves;
int dropcut;
- int oldtime;
+ long int oldtime;
int egscore;
static const int rc_index[14] = {0,1,1,2,2,5,5,3,3,4,4,2,2,0};
@@ -512,7 +515,7 @@
extendedtime = 1;
oldtime = time_for_move;
time_for_move += allocate_time();
- printf("Extended from %d to %d, time left %d\n", oldtime,
+ printf("Extended from %ld to %ld, time left %ld\n", oldtime,
time_for_move,
time_left);
}
@@ -826,11 +829,12 @@
afterincheck = f_in_check(&moves[0], i);
checks[ply] = afterincheck;
- if (!afterincheck && ((Variant == Normal)
- || (Variant == Suicide)
- || (Variant == Losers)) && (depth < 3) &&
- (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6)
- || ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3)))))
+ if (!afterincheck
+ && ((Variant == Normal) || (Variant == Suicide) || (Variant == Losers))
+ && (depth < 3)
+ && (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6))
+ ||
+ ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3))))
{
extend++;
};
@@ -1066,7 +1070,7 @@
}
-move_s search_root (int originalalpha, int originalbeta, int depth) {
+move_s search_root (long originalalpha, long originalbeta, int depth) {
/* search the root node using alpha-beta with negamax search */
@@ -1074,7 +1078,7 @@
int num_moves, i, j;
long int root_score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF];
bool no_moves, legal_move, first;
- int alpha, beta;
+ long alpha, beta;
move_s kswap;
move_s oldbest;
int oldbestnum;
@@ -1447,15 +1451,15 @@
move_s comp_move, temp_move, old_move;
int i, j, k;
- long int elapsed, temp_score, true_score;
+ long int elapsed, temp_score = 0, true_score;
char postmove[STR_BUFF];
clock_t cpu_start, cpu_end;
float et = 0;
- int alpha, beta;
+ long alpha, beta;
int tmptmp;
int rs;
move_s moves[MOVE_BUFF];
- int l, lastlegal, ic;
+ int l, lastlegal = 0, ic;
int pn_restart;
int num_moves;
char output[8];
@@ -1632,7 +1636,7 @@
if (pn_restart) time_for_move = (float)time_for_move * (float)2/((float)pn_restart+1.0);
- printf("Time for move : %d\n", time_for_move);
+ printf("Time for move : %ld\n", time_for_move);
if (time_for_move > 50)
LoadLearn();
@@ -1658,6 +1662,7 @@
if ((forcedwin || result) && (pn_move.target != dummy.target)
&& !is_analyzing)
{
+ cpu_start = clock();
comp_move = pn_move;
}
else
@@ -1861,7 +1866,7 @@
break;
}
}
- for (j = 0; j < num_moves; j++)
+ for (j = 0, k = 0; j < num_moves; j++)
{
if (rootlosers[j]) k++;
}
@@ -1883,7 +1888,7 @@
}
elapsed = rdifftime (rtime (), start_time);
- printf("Used time : %d\n", elapsed);
+ printf("Used time : %ld\n", elapsed);
/* update our elapsed time_cushion: */
if (moves_to_tc && !is_pondering) {
@@ -1937,7 +1942,7 @@
if ((et > 0) && (Variant != Bughouse))
{
- printf("tellics whisper d%d %+.2f %sn: %ld qp: %.0f%% fh: %.0f%% c-x: %d r-x: %d 1-x: %d egtb: %d time: %.2f nps: %ld\n",
+ printf("tellics whisper d%d %+.2f %sn: %ld qp: %.0f%% fh: %.0f%% c-x: %ld r-x: %ld 1-x: %ld egtb: %d time: %.2f nps: %ld\n",
true_i_depth, (float)temp_score/100.0, postpv, nodes,
(((float)qnodes*100)/((float)nodes+1)),
((float)FHF*100)/((float)(FH+1)),
|