公共級國際象棋{
/**
* @param args
*/
公共靜態void main(String[] args) {
int width = 3;
boolean isqual = false
int[][]point = new int[width][width];
for(int I = 0;我& lt寬度;i++){
for(int j = 0;j & lt寬度;j++){
point[I][j]=(int)(math . random()* 2);
system . out . print(point[I][j]+" ");
}
system . out . println();
}
for(int I = 0;我& lt寬度;i++){
for(int j = 0;j & lt寬度;j++){
if(point[i][0] == point[i][j]){
isqual = true
}否則{
isqual = false
打破;
}
}
if(isqual)
system . out . println(" line "+(I+1)+" is all "+point[I][0]);
}
for(int j = 0;j & lt寬度;j++){
for(int I = 0;我& lt寬度;i++){
if(point[0][j] == point[i][j]){
isqual = true
}否則{
isqual = false
打破;
}
}
if(isqual)
system . out . println(" column "+(j+1)+" is all "+point[0][j]);
}
for(int I = 0;我& lt寬度;i++){
if(point[0][0] == point[i][i]){
isqual = true
}否則{
isqual = false
打破;
}
}
if(isqual)
system . out . println(" all from top left to bottom left "+point[0][0]);
for(int I = 0;我& lt寬度;i++){
if(point[width-1][0]= = point[I][width-I-1]){
isqual = true
}否則{
isqual = false
打破;
}
}
if(isqual)
system . out . println(" all from bottom left to top right "+point[0][0]);
}
}