-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathSendProgarmGo.cpp
102 lines (78 loc) · 2.88 KB
/
SendProgarmGo.cpp
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
#include "stdafx.h"
#include "data.h"
#include "chess.h"
#include "Resource.h"
#include "pregen.h"
void SendProgramGo(ChessProgramState *cps){
dispboard_t* pDis = OBS[cps->table];
if(cps->playWhat == NEUTRAL){
MessageBox(pDis->hwndThis,"出错啦!", "引擎不是走子方!!",MB_OK);
return;
}
if(cps->maybeThinking == TRUE){
MessageBox(pDis->hwndThis,"出错啦!", "引擎还在思考!!",MB_OK);
return;
}
TruncateGame(pDis);
if(cps->playWhat != pDis->pos->side){
LogOut("引擎不是走子方!\n");
return;
}
char buf[MSG_SIZ];
TimeDisp_t *pt = &pDis->TimeDisp[cps->playWhat];
TimeDisp_t *pother = &pDis->TimeDisp[cps->playWhat ^ 0x1];
switch(cps->ucci){
case UCCI_UCCI162:
//UCCI 得根据时间设定发送控制时间的go
//SendToProgram("go depth 10\n", cps); //这儿先用这个代替了
//首先发送初始局面,
SendMoveToProgram(pDis,cps);
if(pt->depth != 0){
sprintf_s(buf,sizeof(buf), "go depth %d\n",pt->depth);
}
else if(pt->isBaoGan){
sprintf_s(buf,sizeof(buf), "go wtime %d winc %d btime %d binc %d\n",
pt->msTotal,pt->stepAdd, pother->msTotal,pother->stepAdd);
}
else{ //分段计时
if(pDis->pos->gply/2 >= pt->c1step){
//if(
}
else { //还在第一时间段内
sprintf_s(buf,sizeof(buf),"go movetime %d\n", pt->c1time/(pt->c1step - pDis->pos->gply*2));
}
}
SendToProgram(buf,cps);
StartClocks(pDis); //开始计时
cps->maybeThinking = TRUE;
break;
case UCCI_CYC105:
SendMoveToProgram(pDis,cps);
if(pt->depth != 0){
sprintf_s(buf,sizeof(buf), "go depth %d\n",pt->depth);
}
else if(pt->isBaoGan){
sprintf_s(buf,sizeof(buf), "go wtime %d winc %d btime %d binc %d\n",
pt->msTotal,pt->stepAdd, pother->msTotal,pother->stepAdd);
}
else{ //分段计时
if(pDis->pos->gply/2 >= pt->c1step){
//if(
}
else { //还在第一时间段内
sprintf_s(buf,sizeof(buf),"go movetime %d\n", pt->c1time/(pt->c1step - pDis->pos->gply*2));
}
}
SendToProgram(buf,cps);
StartClocks(pDis); //开始计时
cps->maybeThinking = TRUE;
break;
case UCCI_QH:
break;
case UCCI_DIS:
SendToProgram("go\n", cps);
break;
default:
break;
}
}