谁知道五子棋和围棋的判赢的算法!!!!! 五子棋的棋盘为10x10,使用0表示空子,1表示白子,-1表示黑子,求给出一个程序判断黑子获胜还是白子获胜.还有,我不会下围棋,谁能给个围棋的输赢的规则.>>>>>谢谢拉!!!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int p[][]=new int[10][10];....//落子后判断//int pointX,int pointY 落子坐标public boolean hasVictory(int pointX,int pointY){ int i_temp=p[pointX][pointY]; int count=1; int x=pointX; int y=pointY;//横向判断 while(x>0 && i_temp=p[--x][y]) count++; while(x<9 && i_temp=p[++x][y]) count++; if(count>=5) return true;//纵向判断 count=1; x=pointX; y=pointY; while(y>0 && i_temp=p[x][--y]) count++; while(y<9 && i_temp=p[x][++y]) count++; if(count>=5) return true; //斜向判断1 count=1; x=pointX; y=pointY; while(y>0 && x>0 && i_temp=p[--x][--y]) count++; while(y<9 && x<9 && i_temp=p[++x][++y]) count++; if(count>=5) return true;//斜向判断2 count=1; x=pointX; y=pointY; while(y>0 && x<9 && i_temp=p[++x][--y]) count++; while(y<9 && x>0 && i_temp=p[--x][++y]) count++; if(count>=5) return true; return false;} 递归剔除字符创中的逗号 为什么socket[i].getOutputStream()这样是错的呢? MANIFEST.MF中怎样设置程序启动内存大小 关于命令行下密码的一个问题 请教一个对象的问题? 为什么最大float数是0x7f800000 ??? 快,急!! 哪儿有关于“诚信”的中英文文章??! 9:10前回答--100分!! java图形界面!!! zlyperson(rookie)近来领分! stringBuilder的父类到底是啥? 数据自动销毁 swing ui怎么用啊?
....
//落子后判断
//int pointX,int pointY 落子坐标
public boolean hasVictory(int pointX,int pointY)
{
int i_temp=p[pointX][pointY]; int count=1;
int x=pointX;
int y=pointY;//横向判断
while(x>0 && i_temp=p[--x][y]) count++;
while(x<9 && i_temp=p[++x][y]) count++;
if(count>=5) return true;//纵向判断
count=1;
x=pointX;
y=pointY;
while(y>0 && i_temp=p[x][--y]) count++;
while(y<9 && i_temp=p[x][++y]) count++;
if(count>=5) return true;
//斜向判断1
count=1;
x=pointX;
y=pointY;
while(y>0 && x>0 && i_temp=p[--x][--y]) count++;
while(y<9 && x<9 && i_temp=p[++x][++y]) count++;
if(count>=5) return true;//斜向判断2
count=1;
x=pointX;
y=pointY;
while(y>0 && x<9 && i_temp=p[++x][--y]) count++;
while(y<9 && x>0 && i_temp=p[--x][++y]) count++;
if(count>=5) return true;
return false;
}