9 #define rxx "ihgfedcba"
10 #define cxx "987654321"
12 static char pchar
[NO_PIECES
] =
13 { 'P','L','N','S','G','B','R','P','L','N','S','B','R','K' };
24 short piece
= 0, flag
= 0;
28 /* algebraic notation */
30 { short piece
= f
- NO_SQUARES
;
31 if ( f
> NO_PIECES
) f
-= NO_PIECES
;
32 flag
= (dropmask
| piece
);
40 if ( flag
& dropmask
)
42 *s
= pchar
[piece
]; s
++;
44 *s
= cxx
[column (t
)]; s
++;
45 *s
= rxx
[row (t
)]; s
++;
49 *s
= cxx
[column (f
)]; s
++;
50 *s
= rxx
[row (f
)]; s
++;
51 *s
= cxx
[column (t
)]; s
++;
52 *s
= rxx
[row (t
)]; s
++;
70 /* #define lts(x) (x>>16) */ /* long to short to convert hashkey to short */
73 #define lts(x) (((x>>48)&0xfffe)|(x&0x1))
75 #define lts(x) (((x>>16)&0xfffe)|(x&0x1))
81 unsigned int bookcount
;
82 unsigned int booksize
;
83 unsigned long maxoffset
;
90 unsigned short hashkey
;
99 printf ("usage %s binbookfile [ -h key bd]\n", x
);
111 unsigned long key
, bd
;
119 if (strcmp (argv
[2], "-h") != 0)
121 key
= strtol (argv
[3], NULL
, 16);
122 bd
= strtol (argv
[4], NULL
, 16);
127 gfd
= open (argv
[1], O_RDONLY
);
130 read (gfd
, &ADMIN
, sizeof (struct gdxadmin
));
131 printf ("entrysize %d\nbooksize %d\nbookcount %d\nmaxoffset %ld\n", sizeof (struct gdxdata
), ADMIN
.booksize
, ADMIN
.bookcount
, ADMIN
.maxoffset
);
132 for (i
= 0; i
< ADMIN
.booksize
; i
++)
134 if (0 > read (gfd
, &DATA
, sizeof (struct gdxdata
)))
144 printf ("bd = %ld key = %ld: ",DATA
.hashbd
,DATA
.hashkey
);
146 if (DATA
.count
&& DATA
.hashbd
== bd
&& lts (key
) == DATA
.hashkey
)
149 printf ("%s ", cvt (DATA
.bmove
,DATA
.flags
));
150 printf ("%s ", cvt (DATA
.hint
,0));
151 printf ("%d\n", DATA
.count
);
154 if (in
&& DATA
.bmove
)
165 /*printf ("out %d\n", c1);*/
179 /*printf ("out %d\n", c1);*/
187 printf ("max %d\nmin %d\navg %f\nsumc %d\n", max
, min
, (float) sum
/ (float) n
, sumc
);