]> git.pld-linux.org Git - packages/Sjeng-Free.git/blame - Sjeng-Free-cleanup.patch
- unbzip2ped
[packages/Sjeng-Free.git] / Sjeng-Free-cleanup.patch
CommitLineData
3386af5f
JB
1--- Sjeng-Free-11.2/book.c.deb 2001-07-16 20:04:48.000000000 +0800
2+++ Sjeng-Free-11.2/book.c 2005-07-03 19:25:22.000000000 +0800
3@@ -21,6 +21,8 @@
4
5 */
6
7+#include <unistd.h>
8+
9 #include "sjeng.h"
10 #include "protos.h"
11 #include "extvars.h"
12--- Sjeng-Free-11.2/ecache.c.deb 2001-12-28 06:25:20.000000000 +0800
13+++ Sjeng-Free-11.2/ecache.c 2005-07-03 19:25:22.000000000 +0800
14@@ -29,7 +29,7 @@
15 {
16 unsigned long stored_hash;
17 unsigned long hold_hash;
18-unsigned int score;
19+long int score;
20 } ECacheType;
21
22 /*ECacheType ECache[ECACHESIZE];*/
23@@ -40,7 +40,7 @@
24
25 void storeECache(long int score)
26 {
27- int index;
28+ unsigned int index;
29
30 index = hash % ECacheSize;
31
32@@ -51,7 +51,7 @@
33
34 void checkECache(long int *score, int *in_cache)
35 {
36- int index;
37+ unsigned int index;
38
39 ECacheProbes++;
40
41@@ -84,7 +84,7 @@
42 exit(EXIT_FAILURE);
43 }
44
45- printf("Allocated %lu eval cache entries, totalling %lu bytes.\n",
46+ printf("Allocated %u eval cache entries, totalling %zu bytes.\n",
47 ECacheSize, sizeof(ECacheType)*ECacheSize);
48 return;
49 }
50--- Sjeng-Free-11.2/epd.c.deb 2001-07-23 03:27:36.000000000 +0800
51+++ Sjeng-Free-11.2/epd.c 2005-07-03 19:25:22.000000000 +0800
52@@ -24,6 +24,7 @@
53 #include "sjeng.h"
54 #include "protos.h"
55 #include "extvars.h"
56+#include <errno.h>
57
58 void setup_epd_line(char* inbuff)
59 {
60@@ -243,6 +244,10 @@
61 thinktime *= 100;
62
63 testsuite = fopen(testname, "r");
64+ if (testsuite==NULL) {
65+ fprintf(stderr, "Cannot open file %s: %s\n", testname, strerror(errno));
66+ return;
67+ }
68
69 while (fgets(readbuff, 2000, testsuite) != NULL)
70 {
71@@ -264,8 +269,8 @@
72 // cpu_end = clock();
73 // rdelay(2);
74
75- elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC;
76- printf("Time: %f\n", elapsed);
77+ // elapsed = (cpu_end-cpu_start)/(double) CLOCKS_PER_SEC;
78+ // printf("Time: %f\n", elapsed);
79
80 if (interrupt()) rinput(tempbuff, STR_BUFF, stdin);
81
82@@ -304,7 +309,7 @@
83
84 printf("Move ordering : %f%%\n", (((float)FHF*100)/(float)FH+1));
85
86- printf("Material score: %d Eval : %d\n", Material, eval());
87+ printf("Material score: %d Eval : %ld\n", Material, eval());
88 printf("\n");
89
90 if (!forcedwin)
91@@ -329,5 +334,6 @@
92 };
93
94 printf("\n");
95+ fclose(testsuite);
96 };
97
98--- Sjeng-Free-11.2/extvars.h.deb 2001-12-28 06:19:58.000000000 +0800
99+++ Sjeng-Free-11.2/extvars.h 2005-07-03 19:25:22.000000000 +0800
100@@ -164,7 +164,7 @@
101 extern int havercfile;
102 extern int TTSize;
103 extern int PBSize;
104-extern int ECacheSize;
105+extern unsigned int ECacheSize;
106
107 extern int my_rating, opp_rating;
108 extern int userealholdings;
109@@ -190,5 +190,3 @@
110
111
112
113-
114-
115--- Sjeng-Free-11.2/learn.c.deb 2001-09-28 18:14:13.000000000 +0800
116+++ Sjeng-Free-11.2/learn.c 2005-07-03 19:25:22.000000000 +0800
117@@ -36,13 +36,13 @@
118 }
119 LearnType;
120
121-void Learn(int score, int best, int depth)
122+void Learn(long score, int best, int depth)
123 {
124 int number = 0, next = 0;
125 LearnType draft;
126 FILE **lrnfile;
127
128- printf("Learning score: %d best: %d depth:%d hash: %X\n", score, best, depth, hash);
129+ printf("Learning score: %ld best: %d depth:%d hash: %lX\n", score, best, depth, hash);
130
131 if (Variant == Normal)
132 {
133@@ -122,6 +122,7 @@
134 {
135 lrnfile = &lrn_losers;
136 }
137+ else return; // Can this happen?
138
139 fseek(*lrnfile, 0, SEEK_SET);
140 fread(&number, sizeof(int), 1, *lrnfile);
141--- Sjeng-Free-11.2/leval.c.deb 2001-09-02 19:04:53.000000000 +0800
142+++ Sjeng-Free-11.2/leval.c 2005-07-03 19:25:22.000000000 +0800
143@@ -120,13 +120,13 @@
144 long int losers_eval (void) {\r
145 \r
146 /* return a score for the current middlegame position: */\r
147- int srank, pawn_file, pawns[2][11], white_back_pawn[11], black_back_pawn[11];\r
148+ int srank = 0, pawn_file = 0, pawns[2][11], white_back_pawn[11], black_back_pawn[11];\r
149 int isolated, backwards;\r
150 int i, a, j;\r
151 long int score = 0;\r
152 int in_cache;\r
153 int wp = 0, bp = 0;\r
154- int wks, bks;\r
155+ int wks = 0, bks = 0;\r
156 int wpassp = 0, bpassp = 0;\r
157 int wpawns = 0, bpawns = 0;\r
158 \r
159--- Sjeng-Free-11.2/moves.c.deb 2001-06-07 06:12:46.000000000 +0800
160+++ Sjeng-Free-11.2/moves.c 2005-07-03 19:25:22.000000000 +0800
161@@ -31,7 +31,7 @@
162 int numb_moves;
163 static move_s *genfor;
164
165-int fcaptures;
166+bool fcaptures;
167 int gfrom;
168
169 int kingcap; /* break if we capture the king */
170--- Sjeng-Free-11.2/neval.c.deb 2001-06-29 03:48:09.000000000 +0800
171+++ Sjeng-Free-11.2/neval.c 2005-07-03 19:25:22.000000000 +0800
172@@ -177,7 +177,7 @@
173 int in_cache;
174 int wp = 0, bp = 0, wn = 0, bn = 0, wb = 0, bb = 0,
175 wq = 0, bq = 0, wr = 0, br = 0;
176- int fwrook, fbrook, rwrook, rbrook;
177+ int fwrook = 0, fbrook = 0, rwrook = 0, rbrook = 0;
178 int wpotential = 0, bpotential = 0, tmp;
179
180 in_cache = 0;
181@@ -818,7 +818,7 @@
182 int in_cache;
183 int wp = 0, bp = 0, wn = 0, bn = 0, wb = 0, bb = 0,
184 wq = 0, bq = 0, wr = 0, br = 0;\r
185- int rbrook, fbrook, rwrook,fwrook;
186+ int rbrook = 0, fbrook = 0, rwrook = 0,fwrook = 0;
187
188 in_cache = 0;
189
190--- Sjeng-Free-11.2/newbook.c.deb 2001-06-07 06:12:39.000000000 +0800
191+++ Sjeng-Free-11.2/newbook.c 2005-07-03 19:25:22.000000000 +0800
192@@ -43,7 +43,7 @@
193 typedef struct
194 {
195 unsigned long played;
196- signed long score;
197+ long int score;
198 } posinfo_t;
199
200 typedef struct
201@@ -118,7 +118,6 @@
202 posinfo_t *pst;
203 datum index;
204 datum data;
205- int win = 0, loss = 0;
206 int ret;
207
208 /* fill in the key field */
209@@ -461,7 +460,7 @@
210 int raw;
211 int num_moves, i;
212 char output[6];
213- signed long scores[MOVE_BUFF], best_score = 0;
214+ long int scores[MOVE_BUFF], best_score = 0;
215
216 srand(time(0));
217
218@@ -524,7 +523,7 @@
219
220 comp_to_coord(moves[i], output);
221
222- printf("Move %s: %ld times played, %d learned\n", output,
223+ printf("Move %s: %ld times played, %ld learned\n", output,
224 ps->played, ps->score);
225
226 if ((ps->played + ps->score) >= PLAYTHRESHOLD)
227@@ -593,7 +592,7 @@
228
229 void book_learning(int result)
230 {
231- GDBM_FILE binbook;
232+ GDBM_FILE binbook = NULL;
233 hashkey_t key;
234 posinfo_t *ps;
235 datum index;
236@@ -675,7 +674,7 @@
237 }\r
238 \r
239 /* don't 'overlearn' */\r
240- if (abs((ps->score)+pi) < (ps->played*5))\r
241+ if ((unsigned long)labs((ps->score)+pi) < (ps->played*5))\r
242 {
243
244 printf("Learning opening %lu, played %lu, old score %ld, new score %ld\n",
245--- Sjeng-Free-11.2/probe.c.deb 2001-09-12 17:28:18.000000000 +0800
246+++ Sjeng-Free-11.2/probe.c 2005-07-03 19:25:22.000000000 +0800
247@@ -121,7 +121,8 @@
248 #endif\r
249 }\r
250 \r
251-const static int EGTranslate(int sqidx)\r
252+#ifdef USE_EGTB\r
253+static int EGTranslate(int sqidx)\r
254 {\r
255 int r;\r
256 \r
257@@ -129,6 +130,7 @@
258 \r
259 return r;\r
260 }\r
261+#endif\r
262 \r
263 int probe_egtb(void)\r
264 {\r
265--- Sjeng-Free-11.2/proof.c.deb 2001-12-28 06:52:15.000000000 +0800
266+++ Sjeng-Free-11.2/proof.c 2005-07-03 19:25:22.000000000 +0800
267@@ -79,7 +79,7 @@
268 void losers_pn_eval (node_t *this);
269
270 unsigned char *membuff;
271-int bufftop = 0;
272+unsigned int bufftop = 0;
273
274 void* Xmalloc(int size)
275 {
276@@ -506,7 +506,6 @@
277 int i;
278 move_s moves[MOVE_BUFF];
279 int l, num_moves;
280- int reploop;
281 int ic;
282
283 if (node->expanded)
284@@ -1024,7 +1023,7 @@
285 node_t *root;
286 node_t *mostproving;
287 node_t *currentnode;
288- int leastlooked, leastlooked_l, leastlooked_i;
289+ int leastlooked, leastlooked_l = 0, leastlooked_i = 0;
290 int losers;
291 int xnodecount;
292 int firsts, alternates;
293@@ -1364,7 +1363,7 @@
294 #endif
295 {
296 #ifdef PN2
297- printf("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d ", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters);
298+ printf("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d ", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters);
299
300 printf ("PV: ");
301
302@@ -1415,7 +1414,7 @@
303 }
304 };
305
306- printf ("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d MaxDepth: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof (node_t) / (float) (1024 * 1024))), iters,maxply);
307+ printf ("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d MaxDepth: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof (node_t) / (float) (1024 * 1024))), iters,maxply);
308
309 if (xb_mode && post)
310 printf ("tellics whisper proof %d, disproof %d, %d nodes, %d forwards, %d iters, highest depth %d\n", root->proof, root->disproof, nodecount, forwards, iters, maxply);
311@@ -1608,7 +1607,7 @@
312 }
313 };
314
315- printf("P: %d D: %d N: %d S: %d Mem: %2.2fM Iters: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters);
316+ printf("P: %d D: %d N: %d S: %ld Mem: %2.2fM Iters: %d\n", root->proof, root->disproof, nodecount, frees, (((nodecount) * sizeof(node_t) / (float)(1024*1024))), iters);
317
318 while(currentnode != root)
319 {
320--- Sjeng-Free-11.2/protos.h.deb 2001-07-18 09:21:37.000000000 +0800
321+++ Sjeng-Free-11.2/protos.h 2005-07-03 19:25:22.000000000 +0800
322@@ -67,7 +67,7 @@
323
324
325 void push_slidE (int target);
326-long int qsearch (int alpha, int beta, int depth);
327+long int qsearch (long alpha, long beta, int depth);
328 void rdelay (int time_in_s);
329 long int rdifftime (rtime_t end, rtime_t start);
330 bool remove_one (int *marker, long int move_ordering[], int num_moves);
331@@ -75,8 +75,8 @@
332 void check_piece_square (void);
333 void rinput (char str[], int n, FILE *stream);
334 rtime_t rtime (void);
335-long int search (int alpha, int beta, int depth, int is_null);
336-move_s search_root (int alpha, int beta, int depth);
337+long int search (long alpha, long beta, int depth, int is_null);
338+move_s search_root (long alpha, long beta, int depth);
339 void start_up (void);
340 move_s think (void);
341 void toggle_bool (bool *var);
342@@ -111,14 +111,14 @@
343 move_s choose_book_move(void);
344 move_s choose_binary_book_move(void);
345
346-void StoreTT(int score, int alpha, int beta, int best , int threat, int depth);
347-void QStoreTT(int score, int alpha, int beta, int best);
348-int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth);
349-int QProbeTT(int *score, int alpha, int beta, int *best);
350-void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth);
351+void StoreTT(long score, long alpha, long beta, int best , int threat, int depth);
352+void QStoreTT(long score, long alpha, long beta, int best);
353+int ProbeTT(long *score, long alpha, long beta, int *best, int *threat, int *donull, int depth);
354+int QProbeTT(long *score, long alpha, long beta, int *best);
355+void LearnStoreTT(long score, unsigned nhash, unsigned hhash, int tomove, int best, int depth);
356
357 void LoadLearn(void);
358-void Learn(int score, int best, int depth);
359+void Learn(long score, int best, int depth);
360
361 void pinput (int n, FILE *stream);
362
363@@ -170,5 +170,9 @@
364 void gen_all_tables(void);
365 int egtb(int s);
366
367+int load_2piece(void);
368+int load_3piece(int w1_man, int b1_man, int b2_man, signed char *t);
369+int init_segtb(void);
370+
371 #endif
372
373--- Sjeng-Free-11.2/rcfile.c.deb 2001-09-28 18:19:18.000000000 +0800
374+++ Sjeng-Free-11.2/rcfile.c 2005-07-03 19:25:22.000000000 +0800
375@@ -21,6 +21,10 @@
376
377 */
378
379+#include <pwd.h>
380+#include <unistd.h>
381+#include <sys/types.h>
382+
383 #include "sjeng.h"
384 #include "protos.h"
385 #include "extvars.h"
386@@ -30,7 +34,7 @@
387 char line[STR_BUFF];
388
389 int TTSize;
390-int ECacheSize;
391+unsigned int ECacheSize;
392 int PBSize;
393
394 int cfg_booklearn;
395@@ -100,7 +104,7 @@
396
397 fgets(line, STR_BUFF, rcfile);
398 while (line[0] == '#') fgets(line, STR_BUFF, rcfile);
399- sscanf(line, "%d", &ECacheSize);
400+ sscanf(line, "%u", &ECacheSize);
401
402 fgets(line, STR_BUFF, rcfile);
403 while (line[0] == '#') fgets(line, STR_BUFF, rcfile);
404@@ -181,6 +185,7 @@
405
406 sprintf(setcode, "%u", setc);
407
408+ fclose(rcfile);
409 initialize_eval();
410 alloc_hash();
411 alloc_ecache();
412--- Sjeng-Free-11.2/search.c.deb 2001-12-28 06:20:56.000000000 +0800
413+++ Sjeng-Free-11.2/search.c 2005-07-03 19:25:22.000000000 +0800
414@@ -264,7 +264,7 @@
415 }
416
417
418-long int qsearch (int alpha, int beta, int depth) {
419+long int qsearch (long alpha, long beta, int depth) {
420
421 /* perform a quiscense search on the current node using alpha-beta with
422 negamax search */
423@@ -275,9 +275,10 @@
424 move_ordering[MOVE_BUFF],
425 see_values[MOVE_BUFF];
426 bool legal_move, no_moves = TRUE;
427- int sbest, best_score, best, delta, bound;
428- int originalalpha;
429- int oldtime;
430+ long best_score, bound, delta;
431+ int sbest, best;
432+ long originalalpha;
433+ long int oldtime;
434 int seev;
435
436 pv_length[ply] = ply;
437@@ -301,7 +302,7 @@
438 extendedtime = 1;
439 oldtime = time_for_move;
440 time_for_move += allocate_time();
441- printf("Extended from %d to %d, time left %d\n", oldtime,
442+ printf("Extended from %ld to %ld, time left %ld\n", oldtime,
443 time_for_move,
444 time_left);
445 }
446@@ -473,7 +474,7 @@
447
448 }
449
450-long int search (int alpha, int beta, int depth, int is_null) {
451+long int search (long alpha, long beta, int depth, int is_null) {
452
453 /* search the current node using alpha-beta with negamax search */
454
455@@ -481,16 +482,18 @@
456 int num_moves, i, j;
457 long int score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF];
458 bool no_moves, legal_move;
459- int bound, threat, donull, best, sbest, best_score, old_ep;
460+ long int best_score, bound;
461+ int threat, donull, best, sbest, old_ep;
462 bool incheck, first;
463- int extend, fscore, fmax, selective;
464+ long int fscore, fmax;
465+ int extend, selective;
466 move_s kswap;
467 int ksswap;
468- int originalalpha;
469+ long originalalpha;
470 int afterincheck;
471 int legalmoves;
472 int dropcut;
473- int oldtime;
474+ long int oldtime;
475 int egscore;
476 static const int rc_index[14] = {0,1,1,2,2,5,5,3,3,4,4,2,2,0};
477
478@@ -512,7 +515,7 @@
479 extendedtime = 1;
480 oldtime = time_for_move;
481 time_for_move += allocate_time();
482- printf("Extended from %d to %d, time left %d\n", oldtime,
483+ printf("Extended from %ld to %ld, time left %ld\n", oldtime,
484 time_for_move,
485 time_left);
486 }
487@@ -826,11 +829,12 @@
488 afterincheck = f_in_check(&moves[0], i);
489 checks[ply] = afterincheck;
490
491- if (!afterincheck && ((Variant == Normal)
492- || (Variant == Suicide)
493- || (Variant == Losers)) && (depth < 3) &&
494- (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6)
495- || ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3)))))
496+ if (!afterincheck
497+ && ((Variant == Normal) || (Variant == Suicide) || (Variant == Losers))
498+ && (depth < 3)
499+ && (((board[moves[i].target] == wpawn) && (rank(moves[i].target) >= 6))
500+ ||
501+ ((board[moves[i].target] == bpawn) && (rank(moves[i].target) <= 3))))
502 {
503 extend++;
504 };
505@@ -1066,7 +1070,7 @@
506 }
507
508
509-move_s search_root (int originalalpha, int originalbeta, int depth) {
510+move_s search_root (long originalalpha, long originalbeta, int depth) {
511
512 /* search the root node using alpha-beta with negamax search */
513
514@@ -1074,7 +1078,7 @@
515 int num_moves, i, j;
516 long int root_score = -INF, move_ordering[MOVE_BUFF], see_values[MOVE_BUFF];
517 bool no_moves, legal_move, first;
518- int alpha, beta;
519+ long alpha, beta;
520 move_s kswap;
521 move_s oldbest;
522 int oldbestnum;
523@@ -1447,15 +1451,15 @@
524
525 move_s comp_move, temp_move, old_move;
526 int i, j, k;
527- long int elapsed, temp_score, true_score;
528+ long int elapsed, temp_score = 0, true_score;
529 char postmove[STR_BUFF];
530 clock_t cpu_start, cpu_end;
531 float et = 0;
532- int alpha, beta;
533+ long alpha, beta;
534 int tmptmp;
535 int rs;
536 move_s moves[MOVE_BUFF];
537- int l, lastlegal, ic;
538+ int l, lastlegal = 0, ic;
539 int pn_restart;
540 int num_moves;
541 char output[8];
542@@ -1632,7 +1636,7 @@
543
544 if (pn_restart) time_for_move = (float)time_for_move * (float)2/((float)pn_restart+1.0);
545
546- printf("Time for move : %d\n", time_for_move);
547+ printf("Time for move : %ld\n", time_for_move);
548
549 if (time_for_move > 50)
550 LoadLearn();
551@@ -1658,6 +1662,7 @@
552 if ((forcedwin || result) && (pn_move.target != dummy.target)
553 && !is_analyzing)
554 {
555+ cpu_start = clock();
556 comp_move = pn_move;
557 }
558 else
559@@ -1861,7 +1866,7 @@
560 break;
561 }
562 }
563- for (j = 0; j < num_moves; j++)
564+ for (j = 0, k = 0; j < num_moves; j++)
565 {
566 if (rootlosers[j]) k++;
567 }
568@@ -1883,7 +1888,7 @@
569 }
570 elapsed = rdifftime (rtime (), start_time);
571
572- printf("Used time : %d\n", elapsed);
573+ printf("Used time : %ld\n", elapsed);
574
575 /* update our elapsed time_cushion: */
576 if (moves_to_tc && !is_pondering) {
577@@ -1937,7 +1942,7 @@
578
579 if ((et > 0) && (Variant != Bughouse))
580 {
581- 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",
582+ 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",
583 true_i_depth, (float)temp_score/100.0, postpv, nodes,
584 (((float)qnodes*100)/((float)nodes+1)),
585 ((float)FHF*100)/((float)(FH+1)),
586--- Sjeng-Free-11.2/segtb.c.deb 2001-12-28 06:46:41.000000000 +0800
587+++ Sjeng-Free-11.2/segtb.c 2005-07-03 19:25:22.000000000 +0800
588@@ -742,10 +742,10 @@
589
590 int egtb(int s)
591 {
592- int w1_man, w2_man, b1_man, b2_man;
593- int w1, w2, b1, b2;
594+ int w1_man = 0, w2_man = 0, b1_man = 0, b2_man = 0;
595+ int w1 = 0, w2 = 0, b1 = 0, b2 = 0;
596 int w_count = 0, b_count = 0;
597- int i, t, temp, junk, bpc;
598+ int i, t, temp, junk = 0, bpc;
599 signed char *table;
600
601 /* first figure out what kind of position we have */
602--- Sjeng-Free-11.2/seval.c.deb 2001-07-12 03:25:51.000000000 +0800
603+++ Sjeng-Free-11.2/seval.c 2005-07-03 19:25:22.000000000 +0800
604@@ -121,8 +121,6 @@
605
606 static int black_saccers(int square)
607 {
608- register int ndir, a_sq;
609- register int basq, i;
610 register int f = FALSE;
611
612 /* for white pawn on square, any black
613@@ -148,8 +146,8 @@
614 f = TRUE;
615 }
616 else if (rank(square) == 4 &&
617- board[square + 35] == bpawn ||
618- board[square + 37] == bpawn)
619+ (board[square + 35] == bpawn ||
620+ board[square + 37] == bpawn))
621 {
622 f = TRUE;
623 }
624@@ -205,8 +203,6 @@
625 /* for black pawn on square, any black
626 * pieces that can sac themselves to it? */
627
628- register int ndir, a_sq;
629- register int basq, i;
630 register int f = FALSE;
631
632 /* for white pawn on square, any black
633@@ -232,8 +228,8 @@
634 f = TRUE;
635 }
636 else if (rank(square) == 5 &&
637- board[square - 35] == wpawn ||
638- board[square - 37] == wpawn)
639+ (board[square - 35] == wpawn ||
640+ board[square - 37] == wpawn))
641 {
642 f = TRUE;
643 }
644@@ -298,7 +294,7 @@
645 int isolated, backwards, i, a, j;
646 long int score = 0;
647 int in_cache;
648- int wb = 0, bb = 0, wbc, bbc;
649+ int wb = 0, bb = 0, wbc = 0, bbc = 0;
650 int wk = 0, bk = 0, wr = 0, br = 0;
651 int wn = 0, bn = 0, wp = 0, bp = 0;
652
653--- Sjeng-Free-11.2/sjeng.c.deb 2001-12-28 06:20:38.000000000 +0800
654+++ Sjeng-Free-11.2/sjeng.c 2005-07-03 19:25:22.000000000 +0800
655@@ -38,7 +38,7 @@
656 #include "config.h"\r
657 \r
658 char divider[50] = "-------------------------------------------------";\r
659-move_s dummy = {0,0,0,0,0};\r
660+move_s dummy = {0,0,0,0,0,0};\r
661 \r
662 int board[144], moved[144], ep_square, white_to_move, comp_color, wking_loc,\r
663 bking_loc, white_castled, black_castled, result, ply, pv_length[PV_BUFF],\r
664@@ -90,7 +90,7 @@
665 FILE *lrn_suicide;\r
666 FILE *lrn_losers;\r
667 \r
668-int main (int argc, char *argv[]) {\r
669+int main (void) {\r
670 \r
671 char input[STR_BUFF], *p, output[STR_BUFF];\r
672 char readbuff[STR_BUFF];\r
673@@ -98,10 +98,10 @@
674 int depth = 4;\r
675 bool force_mode, show_board;\r
676 double nps, elapsed;\r
677- clock_t cpu_start, cpu_end;\r
678+ clock_t cpu_start = 0, cpu_end = 0;\r
679 move_s game_history[600];\r
680 move_x game_history_x[600];\r
681- int is_edit_mode, edit_color;\r
682+ int is_edit_mode, edit_color = 0;\r
683 int pingnum;\r
684 int braindeadinterface;\r
685 int automode;\r
686@@ -334,10 +371,10 @@
687 \r
688 printf("Move ordering : %f%%\n", (((float)FHF*100)/(float)(FH+1)));\r
689 \r
690- printf("Material score: %d Eval : %d White hand: %d Black hand : %d\n", \r
691+ printf("Material score: %d Eval : %ld White hand: %d Black hand : %d\n", \r
692 Material, eval(), white_hand_eval, black_hand_eval);\r
693 \r
694- printf("Hash : %X HoldHash : %X\n", hash, hold_hash);\r
695+ printf("Hash : %lX HoldHash : %lX\n", hash, hold_hash);\r
696 \r
697 /* check to see if we mate our opponent with our current move: */\r
698 if (!result) {\r
699@@ -635,7 +672,7 @@
700 }\r
701 else if (!strcmp (input, "eval")) {\r
702 check_phase();\r
703- printf("Eval: %d\n", eval());\r
704+ printf("Eval: %ld\n", eval());\r
705 }\r
706 else if (!strcmp (input, "go")) {\r
707 comp_color = white_to_move;\r
708@@ -667,7 +704,7 @@
709 time_cushion = 0; \r
710 }\r
711 else if (!strncmp (input, "rating", 6)) {\r
712- sscanf (input+7, "%ld %ld", &my_rating, &opp_rating);\r
713+ sscanf (input+7, "%d %d", &my_rating, &opp_rating);\r
714 if (my_rating == 0) my_rating = 2000;\r
715 if (opp_rating == 0) opp_rating = 2000;\r
716 }\r
717@@ -729,6 +766,7 @@
718 printf("Move number : %d\n", move_number);\r
719 if (move_number > 0)\r
720 {\r
721+ ply = 1;\r
722 path_x[0] = game_history_x[--move_number];\r
723 unmake(&game_history[move_number], 0);\r
724 reset_piece_square();\r
725@@ -738,10 +776,12 @@
726 else if (!strncmp (input, "remove", 5)) {\r
727 if (move_number > 1)\r
728 {\r
729+ ply = 1;\r
730 path_x[0] = game_history_x[--move_number];\r
731 unmake(&game_history[move_number], 0);\r
732 reset_piece_square();\r
733 \r
734+ ply = 1;\r
735 path_x[0] = game_history_x[--move_number];\r
736 unmake(&game_history[move_number], 0);\r
737 reset_piece_square();\r
738@@ -789,7 +829,7 @@
739 run_epd_testsuite();\r
740 }\r
741 else if (!strncmp (input, "st", 2)) {\r
742- sscanf(input+3, "%d", &fixed_time);\r
743+ sscanf(input+3, "%ld", &fixed_time);\r
744 fixed_time = fixed_time * 100;\r
745 }\r
746 else if (!strncmp (input, "book", 4)) {\r
747--- Sjeng-Free-11.2/ttable.c.deb 2001-07-13 02:04:48.000000000 +0800
748+++ Sjeng-Free-11.2/ttable.c 2005-07-03 19:25:22.000000000 +0800
749@@ -110,7 +110,7 @@
750
751 }
752
753-void QStoreTT(int score, int alpha, int beta, int best)
754+void QStoreTT(long score, long alpha, long beta, int best)
755 {
756 unsigned long index;
757
758@@ -134,7 +134,7 @@
759 return;
760 }
761
762-void StoreTT(int score, int alpha, int beta, int best, int threat, int depth)
763+void StoreTT(long score, long alpha, long beta, int best, int threat, int depth)
764 {
765 unsigned long index;
766
767@@ -216,7 +216,7 @@
768 return;
769 }
770
771-void LearnStoreTT(int score, unsigned nhash, unsigned hhash, int tomove, int best, int depth)
772+void LearnStoreTT(long score, unsigned nhash, unsigned hhash, int tomove, int best, int depth)
773 {
774 unsigned long index;
775
776@@ -242,7 +242,7 @@
777
778 }
779
780-int ProbeTT(int *score, int alpha, int beta, int *best, int *threat, int *donull, int depth)
781+int ProbeTT(long *score, long alpha, long beta, int *best, int *threat, int *donull, int depth)
782 {
783
784 unsigned long index;
785@@ -328,7 +328,7 @@
786
787 }
788
789-int QProbeTT(int *score, int alpha, int beta, int *best)
790+int QProbeTT(long *score, long alpha, long beta, int *best)
791 {
792
793 unsigned long index;
794--- Sjeng-Free-11.2/utils.c.deb 2001-07-14 00:36:40.000000000 +0800
795+++ Sjeng-Free-11.2/utils.c 2005-07-03 19:25:22.000000000 +0800
796@@ -529,7 +529,8 @@
797
798 void hash_extract_pv(int level, char str[])
799 {
800- int dummy, bm;
801+ int bm, dummy_int;
802+ long dummy_long;
803 move_s moves[MOVE_BUFF];
804 int num_moves;
805 char output[STR_BUFF];
806@@ -538,7 +539,7 @@
807 level--;
808 if (!level) return;
809
810- if(ProbeTT(&dummy, 0, 0, &bm, &dummy, &dummy, 0) != HMISS)
811+ if(ProbeTT(&dummy_long, 0, 0, &bm, &dummy_int, &dummy_int, 0) != HMISS)
812 {
813 gen(&moves[0]);
814 num_moves = numb_moves;
815@@ -1342,7 +1343,7 @@
816 {
817 eval();
818 /* invalidate the ecache */
819- hash = (++hash) % ULONG_MAX;
820+ ++hash;
821 }
822
823 cpu_end = clock ();
This page took 0.171496 seconds and 4 git commands to generate.