|
void Minitance(void)
{
int operation = 0, coordinateX, coordinateY, sum, clienti, clientj, temp, tempi, tempj, state1, state2, state3, state4, state5, state6, state7, state8;/* coordinateX, coordinateY 为坐标,sum是当前的棋子数目,其他为临时变量 */
//在中央打印一个初始的战斗状况
while(TRUE)
{temp{设置为当前鼠标所在的颜色值}/* get the first coordinate */
while(TRUE)
{
PrintScore(1),PrintScore(2);/* 打印分数 */
SetTheFirstColor(operation);/* 设置初始的的颜色 */
fillellipse(coordinateX, coordinateY, 10, 10);/* 在初始位置放置 */
keyboard = bioskey(0);/* 响应键盘 */
if (keyboard == ESC)
break; else if (keyboard == ENTER)/* enter the ENTER to confirm */
{ state1 = state2 = state3 = state4 = state5 = state6 = state7 = state8 = 0;
/* if operation is white */
if((coordinateY != 85) && (gridState[(coordinateX - 115) / 30][(coordinateY - 115) / 30] != 1) && (gridState[(coordinateX-115) / 30][(coordinateY - 115) / 30] != 2))/* (115, 115)为初始位置 */
{/*judge the vailable of the rule */
//判断是不是复核放入棋子,在许多情况没有吃掉对手棋子的时候,是不允许放入棋子的
/* 假如state 状态成立那么就允许执行下一步,3 表示符合情况的状态 */
if (state1 == 3 || state2 == 3 || state3 == 3 || state4 == 3 || state5 == 3 || state6 == 3 || state7 == 3 || state8 == 3)
{
if ( operation % 2 == 0)
gridState[(coordinateX-115) / 30][(coordinateY-115) / 30] = 1;/* 为黑棋 */
else
gridState[(coordinateX-115) / 30][(coordinateY-115) / 30] = 2;/* 为白棋 */
/* the change of the screen moving the circle */
PriChange(coordinateX, coordinateY);/* 打印变化 */
TranScore();/* the tran of the score */
break;/* get to next step */
}
else
continue;/* continue when failed */
}
/* judge the keyboard */
//对键盘中的上下左右进行移动操作
if (keyboard == ESC)
break;
//处理sum量,处理sum的量
PlayTheResult();/* get the result to the screen */
operation++;
if (operation == 11)/* when operation achieve the 11 then to 1 */
operation = 1;
}/* END: while(TRUE) */
}
|