如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacewuziqi{classProgram{publicstaticvoidMain(string[]args){intmaxsize=19;//棋盘行列最大值intx,y;//用于定位下棋位置stringx1,y1;//临时变量获取棋手输入的坐标值(此时坐标值属于字符串类型)intcol_up=0,col_down=0;//用于统计输入坐标值的上下相同棋子的个数introw_left=0,row_right=0;//用于统计输入坐标值的左右相同棋子的个数intdia_left_up=0,dia_left_down=0,dia_right_up=0,dia_right_down=0;//对角线的英文拼写(diagonalline)用于统计对角线上相同的棋子数目intm;//临时变量,用于控制判断相同棋子比较的次数intjudgement;//用于获取判断是否要结束棋局或继续棋局的变量string[,]qipan=newstring[24,24];//定义二维棋盘//初始化棋盘label0:{Console.Clear();//五子棋规则Console.WriteLine("===============================================");Console.WriteLine("五子棋规则说明如下:");Console.WriteLine("1、下棋坐标是从1-15");Console.WriteLine("2、下棋坐标值为整型数据类型");Console.WriteLine("3、下棋双方先构成五子连线者胜");Console.WriteLine("===============================================");for(inti=5;i<=maxsize;i++){for(intj=5;j<=maxsize;j++){qipan[i,j]="╋";}}}//输出棋盘for(inti=5;i<=maxsize;i++){for(intj=5;j<=maxsize;j++){Console.Write(qipan[i,j]);}Console.Write("\n");}//走棋label2:{//甲方走棋Console.WriteLine("===============================================");Console.WriteLine("请甲方走棋(棋盘为15x15)");Console.Write("x=");x1=Console.ReadLine();//判断输入的坐标值是否为字母foreach(charchinx1){if((ch>'a'&&ch<'z')||(ch>'A'&&ch<'Z')){Console.WriteLine("你输入的坐标值非法!请正确输入你的坐标值");gotolabel2;}}//判断输入的棋子坐标是否为空if(x1==""||x1==null){Console.WriteLine("===============================================");Console.WriteLine("你输入的棋盘坐标为空!");gotolabel2;}Console.Write("y=");y1=Console.ReadLine();//判断输入的坐标值是否为字母foreach(charchiny1){if((ch>'a'&&ch<'z')||(ch>'A'&&ch<'Z')){Console.WriteLine("你输入的坐标值非法!请正确输入你的坐标值");gotolabel2;}}//判断输入的棋子坐标是否为空if(y1==""||y1==null){Console.WriteLine("===============================================");Console.WriteLine("你输入的棋盘坐标为空!");gotolabel2;}x=int.Parse(x1);y=int.Parse(y1);if(x>=16||y>=16){Console.WriteLine("===============================================");Con