p; ,Font.SIZE_LARGE));
if(isRedWin!=0)
{
if(g2%2==1){
g.setColor(255,0,0);
g.drawString("该红方走了",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);
}
}
else{ g.setColor(255,255,255);
g.drawString("白方胜利",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}
if(isWhiteWin!=0)
{
if(g2%2==0){
g.setColor(255,255,255);
g.drawString("该白方走了",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);
}
}
else{ g.setColor(255,0,0);
g.drawString("红方胜利",x,x+chessR+10*cellWidth,Graphics.LEFT|Graphics.BOTTOM);}
}
protected void checkWin()//判断输赢
{ isRedWin=0;isWhiteWin=0;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++){if(point[0+i][3+j]==5){isRedWin++;}}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++){if(point[7+i][3+j]==21){isWhiteWin++;}}
}
}
protected void paintSelected(Graphics g)//画选择框
{
g.setColor(0,0,255);
g.drawRect(x-chessR+selectedX*cellWidth,x-chessR+selectedY*cellWidth,2*chessR,2*chessR);
}
protected void paint(Graphics g)
{
g.setColor(0x00000000);
g.fillRect(0, 0, getWidth(), getHeight());
paintMapa(g);
paintMapb(g);
paintMapc(g);
paintAllChess(g);
if(guard%2==1)
{
chooseChess(g);
}
paintSelected(g);
whoIsGoing(g);
}
protected void changTwoChessNum(int m,int n,int selectedX,int selectedY)//改变两个格子的值
{
g2++;
p=point[selectedY][selectedX];
point[selectedY][selectedX]=point[n][m];
point[n][m]=0;
q=word[selectedY][selectedX];
word[selectedY][selectedX]=word[n][m];
word[n][m]="空";
}
protected void theRuleOfChe(int m,int n,int selectedX,int selectedY)//车的规则
{
g=0;
if(m==selectedX)
{
if(n>selectedY)
{
for(i=1;i {
if(point[selectedY+i][m]!=0){g++;}
}
}
else
{
for(i=1;i {
if(point[n+i][m]!=0){g++;}
}
}
if(g==0){changTwoChessNum(m,n,selectedX,selectedY);}
}
if(n==selectedY)
{
if(m>selectedX)
{
for(i=1;i {
if(point[n][i+selectedX]!=0){g++;}
}
}
else
{
for(i=1;i {
if(point[n][m+i]!=0){g++;}
}
}
if(g==0){changTwoChessNum(m,n,se