java五子棋人机版10版本文档格式.docx
- 文档编号:17012985
- 上传时间:2022-11-27
- 格式:DOCX
- 页数:22
- 大小:18.30KB
java五子棋人机版10版本文档格式.docx
《java五子棋人机版10版本文档格式.docx》由会员分享,可在线阅读,更多相关《java五子棋人机版10版本文档格式.docx(22页珍藏版)》请在冰豆网上搜索。
,'
0'
1'
2'
3'
4'
5'
6'
7'
8'
9'
'
a'
b'
c'
d'
e'
f'
};
for(inti=0;
i<
ches.length;
i++){
chess[0][i]=chess[i][0]=ches[i];
}
for(inti=1;
chess.length;
for(intj=1;
j<
chess[i].length;
j++){
chess[i][j]='
*'
;
}
}
publicstaticvoidprintChess(){
for(intj=0;
System.out.print(chess[i][j]+"
"
);
System.out.println();
publicstaticbooleanisRule(chara,charb){
if(((a>
='
&
&
a<
)||(a>
))
&
((b>
b<
)||(b>
))){
intx=0,y=0;
for(inti=1;
if(chess[i][0]==a)
x=i;
if(chess[0][i]==b)
y=i;
if(chess[x][y]=='
o'
||chess[x][y]=='
x'
)
returnfalse;
else
returntrue;
returnfalse;
publicstaticintisFourWin(chara){
for(inti=chess.length-1;
i>
3;
i--){
chess[0].length;
if(j>
3){
if((chess[i][j]==a)
&
(chess[i][j]==chess[i-1][j-1])
(chess[i-1][j-1]==chess[i-2][j-2])
(chess[i-2][j-2]==chess[i-3][j-3])){
x1=i-3;
y1=j-3;
x2=i;
y2=j;
z=3;
if(a=='
){
computer(0);
if(is==0)
continue;
else
return1;
}elseif(a=='
computer
(1);
}
}
}
if(j<
chess[i].length-3){
if((chess[i][j]==a)&
(chess[i][j]==chess[i-1][j])
(chess[i-1][j]==chess[i-2][j])
(chess[i-2][j]==chess[i-3][j])){
y1=j;
z=2;
(chess[i][j]==chess[i-1][j+1])
(chess[i-1][j+1]==chess[i-2][j+2])
(chess[i-2][j+2]==chess[i-3][j+3])){
x1=i;
x2=i-3;
y2=j+3;
z=4;
(chess[i][j]==chess[i][j+1])
(chess[i][j+1]==chess[i][j+2])
(chess[i][j+2]==chess[i][j+3])){
z=1;
}else{
return0;
publicstaticintisThreeWin(chara){
2;
2){
(chess[i-1][j-1]==chess[i-2][j-2])){
x1=i-2;
y1=j-2;
chess[i].length-2){
(chess[i-1][j]==chess[i-2][j])){
(chess[i-1][j+1]==chess[i-2][j+2])){
x2=i-2;
y2=j+2;
(chess[i][j+1]==chess[i][j+2])){
publicstaticbooleanisWin(chara){
4;
4){
(chess[i-2][j-2]==chess[i-3][j-3])
(chess[i-3][j-3]==chess[i-4][j-4])){
returntrue;
chess[i].length-4){
if(((chess[i][j]==a)&
(chess[i-2][j]==chess[i-3][j])&
(chess[i-3][j]==chess[i-4][j]))
||((chess[i][j]==a)
&
(chess[i-2][j+2]==chess[i-3][j+3])&
(chess[i-3][j+3]==chess[i-4][j+4]))
(chess[i][j+2]==chess[i][j+3])&
(chess[i][j+3]==chess[i][j+4]))){
(chess[i-2][j]==chess[i-3][j])
(chess[i-3][j]==chess[i-4][j])){
publicstaticbooleanisNull(chara){
('
==chess[i-1][j-1])
(a==chess[i-2][j-2])
chess[i-1][j-1]='
}elseif((chess[i][j]==a)
==chess[i-2][j-2])
(a==chess[i-3][j-3])){
chess[i-2][j-2]='
==chess[i-1][j])
(a==chess[i-2][j])
chess[i-1][j]='
==chess[i-2][j])
(a==chess[i-3][j])){
chess[i-2][j]='
==chess[i-1][j+1])
(a==chess[i-2][j+2])
chess[i-1][j+1]='
==chess[i-2][j+2])
(a==chess[i-3][j+3])){
chess[i-2][j+2]='
==chess[i][j+1])
(a==chess[i][j+2])
chess[i][j+1]='
}else
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 五子棋 人机 10 版本