Home > Back-end >  C for help! Why is the return value is 80?
C for help! Why is the return value is 80?

Time:12-06

# include
Char C1 and C2, M1, M2, P1, P2, X1, X2, S1, S2, J, B1, B2, B3, B4, B5.
Char c1 and c2, m1, m2, p1, p2, x1, x2, s1, s2, j, b1, b2, b3, b4, b5.
Float SC1 and SC2, SM1, SM2, SP1, SP2, SX1, SX2, SS1, SS2, SJ, SB1, SB2, SB3, SB4, SB5;
Float sc1 and sc2, sm1, sm2, sp1, sp2, sx1, sx2, ss1, ss2, sj, sb1, sb2, sb3, sb4, sb5;
Char SBoard [9] [10]=
{
B1, C1, 0, 0, 0, 0, B1, 0, 0, C1,
M1, 0, P1, 0, 0, 0, 0, P1, 0, M1,
X1, 0, 0, B2, 0, 0, B2, 0, 0, X1,
S1, 0, 0, 0, 0, 0, 0, 0, 0, S1,
J, 0, 0, B3, 0, 0, B3, 0, 0, J,
S2, 0, 0, 0, 0, 0, 0, 0, 0, S2,
X2, 0, 0, B4, 0, 0, B4, 0, 0, X2,
M2, 0, P1, 0, 0, 0, 0, P1, 0, M2,
C2, 0, 0, B5, 0, 0, B5, 0, 0, C2
};

Int Jud (int x, int y, int k)
{
Int style;
If (SBoard [x] [y]==C1 | | SBoard [x] [y]==M1 | | SBoard [x] [y] P1==| | SBoard [x] [y]==X1 | | SBoard [x] [y]==S1 | | SBoard [x] [y]==J | | SBoard [x] [y]==C2 | | SBoard [x] [y]==M2 | | SBoard [x] [y]==P2 | | SBoard [x] [y]==X2 | | SBoard [x] [y]==S2 | | SBoard [x] [y]==B1 | | SBoard [x] [y]==B2 | | SBoard [x] [y]==B3 | | SBoard [x] [y]==B4 | | SBoard [x] [y]==B5)
{
Style=1;
}
The else
{
If (SBoard [x] [y]==0)
{
Style=0;
}
The else
{
Style=1;
}
}

If (k==0)
{
Return style;
}
If (k==1)
{
The return - style;
}
If (k==2)
{
If (style> 0)
{
Return style;
}
The else
{
The return - style;
}
}
}

Float the evaluate (int Jud1)
{
//0, 1
//red, black
Int I, a, flag, flag3, temp1, temp2;
Float SC1=0, SC2=0, the SM1=0, SM2=0, SP1=0, SP2=0, SX1=0, SX2=0, SS1=0, SS2=0, SJ=0, SB1=0, SB2=0, SB3=0, SB4=0, SB5=0;
Float sc1=0, sc2=0, the sm1=0, sm2=0, sp1=0, sp2=0, sx1=0, sx2=0, ss1=0, ss2=0, sj=0, sb1=0, sb2=0, sb3=0, sb4=0, sb5=0;
//statistical solid point and mobile point
for (i=1; i<=9; I++)
{
For (a=1; a<=10; +)
{
If (SBoard [I] [a]==C1)
{
//Cright
For (temp1=I + 1; Temp1 & lt;=9; Temp1 + +)
{
Flag3=Jud (temp1, a, 2);
If (flag3==1)
{
SC1 + +;
break;
}
The else
{
SC1 + +;
}
}

}


}
}

If (Jud1==0)
{
Return SC1.
}
}


Int main ()
{
Float t;
T=the evaluate (0);
Printf (" % f \ n ", t);
return 0;
}



//C1 is the lower left corner of the red car, it can attack to the point on the right side of the only one (red horse that location), so the SC1 value should be 1, but the actual return is 80, what happened!
  • Related