java五子棋人机版12Word格式文档下载.docx
- 文档编号:20699415
- 上传时间:2023-01-25
- 格式:DOCX
- 页数:69
- 大小:24.57KB
java五子棋人机版12Word格式文档下载.docx
《java五子棋人机版12Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《java五子棋人机版12Word格式文档下载.docx(69页珍藏版)》请在冰豆网上搜索。
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();
publicstaticbooleanisRational(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;
publicstaticbooleanisWin(chara){
for(inti=chess.length-1;
i>
4;
i--){
chess[0].length;
if(j>
4){
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])
(chess[i-3][j-3]==chess[i-4][j-4])){
returntrue;
}
}
if(j<
chess[i].length-4){
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])&
(chess[i-3][j]==chess[i-4][j]))
||((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])&
(chess[i-3][j+3]==chess[i-4][j+4]))
(chess[i][j]==chess[i][j+1])
(chess[i][j+1]==chess[i][j+2])
(chess[i][j+2]==chess[i][j+3])&
(chess[i][j+3]==chess[i][j+4]))){
}else{
if((chess[i][j]==a)&
(chess[i-2][j]==chess[i-3][j])
(chess[i-3][j]==chess[i-4][j])){
publicstaticvoidgamer(chara,charb){
intx=0,y=0;
if(chess[i][0]==a)
x=i;
if(chess[0][i]==b)
y=i;
if(first==0){
f1=x;
f2=y;
chess[x][y]='
publicstaticvoidfirstOneChess(){
intx=f1,y=f2;
inti=r.nextInt(8);
switch(i){
case0:
chess[x-1][y-1]='
break;
case1:
chess[x-1][y]='
case2:
chess[x-1][y+1]='
case3:
chess[x][y-1]='
case4:
chess[x][y+1]='
case5:
chess[x+1][y-1]='
case6:
case7:
chess[x+1][y+1]='
publicstaticvoidcomputerStep(){
chess[c1][c2]='
publicstaticbooleanisFour(chara){
3;
3){
(chess[i-2][j-2]==chess[i-3][j-3])){
x1=i-3;
y1=j-3;
x2=i;
y2=j;
z=3;
if(a=='
){
if(isNullFour('
returntrue;
}elseif(a=='
}
chess[i].length-3){
(chess[i-2][j]==chess[i-3][j])){
y1=j;
z=2;
(chess[i-2][j+2]==chess[i-3][j+3])){
x1=i;
x2=i-3;
y2=j+3;
z=4;
(chess[i][j+2]==chess[i][j+3])){
z=1;
publicstaticbooleanisThree(chara){
2;
2){
(chess[i-1][j-1]==chess[i-2][j-2])){
x1=i-2;
y1=j-2;
if(isNullThree('
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])){
publicstaticbooleanisLeftThree(chara){
(chess[i-2][j-2]=='
(a==chess[i-3][j-3])){
if(isLeftNullThree('
('
==chess[i-2][j])
(a==chess[i-3][j])){
==chess[i-1][j+1])
(a==chess[i-2][j+2])
==chess[i][j+1])
(a==chess[i][j+2])
y2=j+
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 五子棋 人机 12
![提示](https://static.bdocx.com/images/bang_tan.gif)