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
|
$NetBSD: patch-aa,v 1.3 2013/04/30 22:20:58 joerg Exp $
--- book.cpp.orig 2000-04-30 09:56:26.000000000 +0000
+++ book.cpp
@@ -12,12 +12,14 @@
#include "const.h"
#include <stdio.h>
#include <string.h>
-#include <iostream.h>
-#include <iomanip.h>
-#include <fstream.h>
+#include <iostream>
+#include <iomanip>
+#include <fstream>
#include <math.h>
#include <time.h>
+using namespace std;
+
/* variables for book learning */
book_rec learn_book[100]; // book learning array
int learn_count = 0; // number of book moves played
@@ -51,8 +53,8 @@ void build_book(position ipos)
char instring[100], line[100]; // strings from input files
char outbook[100];
position temp_pos; // temporary position
- move bmove; // book move under consideration
- unsigned __int64 pcode; // hash code for position
+ my_move bmove; // book move under consideration
+ u_int64_t pcode; // hash code for position
int i = -1, j = 0, k = 0, p; // loop variables
int count = 0, thresh, LINE_DEPTH; // control variables
@@ -241,11 +243,11 @@ book_rec book_record; // working reco
position temporary_pos; // working position
/* Function to find a position in the book */
-int find_record(position p, move m, int file_size)
+int find_record(position p, my_move m, int file_size)
{
file_pos = 0;
int jump = int(file_size/2);
- unsigned __int64 pcode = ZERO;
+ u_int64_t pcode = ZERO;
temporary_pos = p;
if(!exec_move(&temporary_pos, m, 1)) return 0;
@@ -299,13 +301,13 @@ int find_record(position p, move m, int
// position is in the book. If so, the move in question
// becomes a candidate move. Information is stored to
// facilitate easy learning during the game.
-move opening_book(h_code hash_code, position p)
+my_move opening_book(h_code hash_code, position p)
{
int file_size, mflag = 0, j;
int candidates = 0, total_score = 0;
int logger = 0, poster = 0;
move_list list;
- move nomove; nomove.t = 0;
+ my_move nomove; nomove.t = 0;
char book_file[100]; // file name for the book
// generate legal moves
@@ -398,7 +400,7 @@ int edit_book(h_code hash_code, position
int file_size, mflag = 0, j, outflag = 0;
int search_time = 0, total_score = 0;
move_list list;
- move nomove; nomove.t = 0;
+ my_move nomove; nomove.t = 0;
char resp[2];
char book_file[100]; // file name for the book
@@ -462,7 +464,7 @@ int edit_book(h_code hash_code, position
if(outflag == 1) cout << "\n";
/* Edit mode for individual moves */
- move edit_move;
+ my_move edit_move;
while(1) {
cout << "\nEnter a move to be edited/investigated (0 = quit): ";
cin >> mstring; if(mstring[0] == '0') break;
|