为了 8番,
程式如何决定是否吃上家打出的牌, cando= 能得到的 番数,
//电脑的能力 其实很差的,主要靠设计者的功力.
c1=del&15; //del=上家打出的牌, z0[]=本身所具有的牌
if (c1 >= 2 && z0[del - 2] >= 1 && z0[del - 1] >= 1) { trydo |=
1; yes = 1; c9 = del - 2; }
if (c1 >= 1 && c1 != 8 && z0[del - 1] >= 1 && z0[del + 1] >= 1) {
trydo |= 2; yes = 2; c9 = del - 1; }
if (c1 <= 6 && z0[del + 1] >= 1 && z0[del + 2] >= 1) { trydo |=
4; yes = 3; c9 = del; }
if (yes == 0) return -1;
if (TreatDragonHasDel(k,trydo, c1,1) == 0)
if (TreatDragonHasDel(k,trydo, c1,2) == 0)
TreatDragonHasDel(k,trydo, c1,3);
int TreatDragonHasDel(int k,int trydo, int c1, int fg)
{
int DelK=k;
if ((trydo & 1) != 0)
if (TreatDragon00(k, c1 - 2, 1) != 0) return 1;
if ((trydo & 2) != 0)
if (TreatDragon00(k, c1 - 1, 2) != 0) return 1;
if ((trydo & 4) != 0)
if (TreatDragon00(k, c1 - 0, 3) != 0) return 1;
return 0;
}
int TreatDragon00(int kk,int j0, int fg)
{//2008.8
int MinCT0 = MinCT;
stack.Clear(); MinCT = fg;
int jj, k1,k, k2, CanDo = 0, need17 = 1, j1, j2,ret=0,specj=0;
k = del >> 4; k1 = (k + 1) % 3; k2 = (k + 2) % 3; //cc=del&15;
DelIsNeed = 0;
while (CanDo == 0)
{
if (Has3_A(k, j0, 1) >= 3) { CanDo = 24; need17 = 0; break;
}//=13;
if (j0 <= 2 &&(ret=Has333(k, j0 + 0, 1)) >= 1) { CanDo = 16;
need17 = 0; specj = j0 + 2; break; }
if (j0 >= 2 &&(ret=Has333(k, j0 - 2, 1)) >= 1) { CanDo = 16;
need17 = 0; specj = j0; break; }
if (j0 >= 4 &&(ret=Has333(k, j0 - 4, 1)) >= 1) { CanDo = 16;
need17 = 0; specj = j0 - 2; break; }
if ((j0 % 3) == 0)
{
if (Has3(k, 0, k, 3, k, 6, 1) >= 1) { CanDo = 18; need17
= 0; break; }
else
{
j1 = (j0 + 3) % 9; j2 = (j0 + 6) % 9; //2008.9
if (Has3(k, j0, k1, j1, k2, j2, 1) >= 1) { CanDo = 8;
break; }
else if (Has3(k, j0, k1, j2, k2, j1, 1) >= 1) { CanDo
= 8; break; }
}
}
if (Has3(k, j0, k1, j0, k2, j0, 1) >= 1) { CanDo = 10; need17
= 0; break; }
else
{
if (j0 <= 4)
if (Has3(k, j0, k1, j0 + 1, k2, j0 + 2, 1) >= 1) {
CanDo = 6; break; } //2008.9
else if (Has3(k, j0, k1, j0 + 2, k2, j0 + 1, 1) >= 1)
{ CanDo = 6; break; }
if (j0 >= 1 && j0 <= 5)
if (Has3(k, j0, k1, j0 - 1, k2, j0 + 1, 0) >= 1) {
CanDo = 6; break; }
else if (Has3(k, j0, k1, j0 + 1, k2, j0 - 1, 1) >= 1)
{ CanDo = 6; break; }
if (j0 >= 2 && j0 <= 6)
if (Has3(k, j0, k1, j0 - 1, k2, j0 - 2, 0) >= 1) {
CanDo = 6; break; }
else if (Has3(k, j0, k1, j0 - 2, k2, j0 - 1, 1) >= 1)
{ CanDo = 6; break; }
break;
}
int need = 0;
if (ret == 11)
{
if (del == specj || del == specj + 2) need = 1;
}
else if (ret == 12)
{
if (del == specj - 1 || del == specj || del == specj + 1)
need = 1;
}
else if (z0[del] == 0) need = 1;
MinCT = MinCT0; DoEatJob1 = 0;//stack.Clear();
if (CanDo != 0)
{
if (DelIsNeed > 0&& need>0)
if (EatJob1(kk, fg, 100) > 0) { DoEatJob1 = 100+CanDo;
return kk + 10; }//2008.6 fg,0->fg,100
DoEatJob1 = CanDo;
return kk + 1;
}
return 0;
}