1: #include "old.h"
2:
3: bplay()
4: {
5: int v1, v2, *p1, *p2, *p3, ab;
6:
7: if(value > ivalue)
8: ivalue = value;
9: ab = 0;
10: v1 = -3000;
11: ply = 0;
12: p1 = (int *) statl();
13: if(lmp == p1+2) {
14: abmove = p1[1];
15: lmp = p1;
16: return(ivalue);
17: }
18: p2 = p1;
19: mantom = !mantom;
20: while(p2 != lmp) {
21: p2++;
22: bmove(*p2);
23: if(testf) {
24: mantom = !mantom;
25: bstatic(1);
26: mantom = !mantom;
27: }
28: if(rept())
29: v2 = 0; else
30: v2 = wplay1(v1);
31: if(v2 > v1 && !mate(3, 0)) {
32: ab = *p2;
33: v1 = v2;
34: }
35: bremove();
36: if(testf) {
37: mantom = !mantom;
38: printf("%6d ", v2);
39: out(*p2);
40: printf("\n");
41: mantom = !mantom;
42: }
43: p2++;
44: }
45: if(ab == 0 && lmp != p1)
46: ab = p1[1];
47: mantom = !mantom;
48: lmp = p1;
49: abmove = ab;
50: return(v1);
51: }
52:
53: bplay1(ab)
54: int ab;
55: {
56: int v1, v2, *p1, *p2;
57:
58: if(ply >= depth)
59: return(bquies(ab));
60: ply++;
61: p1 = p2 = lmp;
62: bgen();
63: qsort(p1, lmp);
64: v1 = -3000;
65: while(p2 != lmp) {
66: if(intrp)
67: goto out;
68: p2++;
69: bmove(*p2);
70: if(wattack(bkpos)) {
71: v2 = wplay1(v1);
72: if(v2 > v1)
73: v1 = v2;
74: }
75: bremove();
76: if(v1 >= ab)
77: goto out;
78: p2++;
79: }
80: out:
81: ply--;
82: lmp = p1;
83: if(v1 == -3000) {
84: v1++;
85: if(!check())
86: v1 = 0;
87: }
88: return(v1);
89: }
90:
91: bquies(ab)
92: int ab;
93: {
94: int *p1, *p2, *p3, v1, v2;
95:
96: if(ply >= qdepth)
97: return(ivalue);
98: p1 = p2 = p3 = lmp;
99: bgen();
100: while(p2 != lmp) {
101: v1 = -(*p2++);
102: if(v1 != value && v1 >= ivalue-50) {
103: *p3++ = ((-(pval+6)[board[*p2>>8]]/100)<<8) |
104: ((pval+6)[board[*p2&0377]]/100);
105: *p3++ = *p2;
106: }
107: p2++;
108: }
109: if(p3 == p1) {
110: lmp = p1;
111: return(value);
112: }
113: ply++;
114: qsort(p1, p3);
115: lmp = p3;
116: p2 = p1;
117: v1 = value;
118: while(p2 != lmp) {
119: p2++;
120: bmove(*p2);
121: if(wattack(bkpos)) {
122: v2 = wquies(v1);
123: } else
124: v2 = -3000;
125: if(v2 > v1)
126: v1 = v2;
127: bremove();
128: if(v1 >= ab)
129: goto out;
130: p2++;
131: }
132: out:
133: ply--;
134: lmp = p1;
135: return(v1);
136: }
Defined functions
bplay
defined in line
3; used 1 times