中国象棋(代码)

合集下载

java课程设计---中国象棋对弈系统

java课程设计---中国象棋对弈系统

java课程设计---中国象棋对弈系统⽬录摘要 (1)关键字 (1)正⽂ (2)1、程序设计说明 (2)1.1 程序的设计及实现 (2)1.1.1搜索引擎的实现(engine包) (2)1.1.2信息传输机制(message包) (3)1.1.3棋⼦(pieces包) (3)1.2 主控模块(main包) (3)2、运⾏结果 (5)3、设计体会 (6)附件 (7)程序代码 (7)参考⽂献资料 (41)1中国象棋对弈系统Java语⾔程序设计实验报告实验项⽬名称:中国象棋对弈系统作者姓名与单位:李⾮计算机101摘要:本⽂主要是运⽤java实现具有⼀定功能的中国象棋对弈系统软件,主要功能如下:a、象棋对弈:红⽅先⾛,然后⿊⽅再⾛,红⿊交替,直到⼀⽅获胜。

b、新游戏:任何时候可以重新开始⼀盘新的对弈。

c、悔棋:当⾛错棋的时候可以悔棋。

d、信息提⽰:提⽰当前信息状态。

e、简单的帮助⽂档:象棋规则介绍、软件的简单介绍和编制说明关键词:java、中国象棋对弈系统2正⽂:⼀程序设计说明1.1程序的设计及实现2、message:⽹络对战过程中各种消息及其传递机制的类实现包。

3、main:主界⾯实现包。

4、pieces:棋⼦及其相关类实现包。

现就各个包中的要点给与说明。

1.1.1 搜索引擎的实现(engine包)(1) BitBoard.java:位棋盘的实现,见2.4节。

(2) CCEvalue.java:评价函数知识类。

本程序使⽤开源软件“梦⼊神蛋”的快速评价函数。

该函数包含⼦⼒价值和棋⼦所在位置的奖励值。

⼦⼒价值分别是:帅-0, 仕-40, 象-40, 马-88, 车-200, 炮-96, 兵-9。

帅是⽆价的,⽤0表⽰。

以马为例,位置的奖励值如下:0,-3,5,4,2,2,5,4,2,2,-3,2,4,6,10,12,20,10,8,2,2,4,6,10,13,11,12,11,15,2,0,5,7,7,14,15,19,15,9,8,2,-10,4,10,15,16,12,11,6,2,0,5,7,7,14,15,19,15,9,8,2,4,6,10,13,11,12,11,15,2,-3,2,4,6,10,12,20,10,8,2,0,-3,5,4,2,2,5,4,2,2上⾯的每⾏代表棋盘的⼀条纵线。

中国象棋python代码

中国象棋python代码

中国象棋python代码下面是一个简单的中国象棋的Python 代码示例:# 定义棋盘# 绘制棋盘def draw_board():for row in chessboard:for piece in row:print(piece, end=' ')print()# 判断是否在棋盘内def is_valid_move(x, y):return 0 <= x < 9 and 0 <= y < 10# 判断移动是否合法def is_valid_move(x1, y1, x2, y2):piece = chessboard[y1][x1]target = chessboard[y2][x2]if piece == ' ':return Falseif piece == '車' or piece == '車':if x1 != x2 and y1 != y2:return Falseif x1 == x2:min_y, max_y = (y1, y2) if y1 < y2 else (y2, y1)for y in range(min_y + 1, max_y):if chessboard[y][x1] != ' ':return Falseif y1 == y2:min_x, max_x = (x1, x2) if x1 < x2 else (x2, x1)for x in range(min_x + 1, max_x):if chessboard[y1][x] != ' ':return Falseif piece == '馬' or piece == '馬':dx = abs(x2 - x1)dy = abs(y2 - y1)if (dx == 1 and dy == 2) or (dx == 2 and dy == 1): return Truereturn Falseif piece == '象' or piece == '相':if y2 > 4 and (y2 - y1) % 2 != 0:return Falseif abs(x2 - x1) != 2 or abs(y2 - y1) != 2:return Falseif chessboard[(y1 + y2) // 2][(x1 + x2) // 2] != ' ': return Falseif piece == '士' or piece == '士':if x2 < 3 or x2 > 5:return Falseif y2 < 7 or y2 > 9:return Falseif abs(x2 - x1) != 1 or abs(y2 - y1) != 1: return Falseif piece == '帥' or piece == '将':if x2 < 3 or x2 > 5:return Falseif y2 < 0 or y2 > 2:return Falseif abs(x2 - x1) + abs(y2 - y1) != 1:return Falseif piece == '兵':if y1 < 5 and y2 != y1 - 1:return Falseif y1 >= 5 and (x1 != x2 or y2 != y1 - 1):return Falseif piece == '卒':if y1 > 4 and y2 != y1 + 1:return Falseif y1 <= 4 and (x1 != x2 or y2 != y1 + 1):return Falseif target == '帥' or target == '将':if piece == '卒' or piece == '兵':if y2 > 2:return Falseif piece == '兵' or piece == '卒':if y2 < 7:return Falsereturn True# 移动棋子def move_piece(x1, y1, x2, y2):if is_valid_move(x1, y1, x2, y2):piece = chessboard[y1][x1]chessboard[y2][x2] = piecechessboard[y1][x1] = ' 'else:print("Invalid move!")# 游戏循环def game_loop():while True:draw_board()player_input = input("请输入移动的起始位置和目标位置,以逗号分隔(例如:2,1,2,3):")positions = player_input.split(',')if len(positions) != 4:print("请输入正确的起始位置和目标位置!")continuex1, y1, x2, y2 = map(int, positions)if not is_valid_move(x1, y1) or not is_valid_move(x2, y2):print("请输入正确的起始位置和目标位置!")continuemove_piece(x1, y1, x2, y2)# 启动游戏game_loop()这是一个简单的中国象棋游戏代码示例,包括棋盘的绘制、棋子移动的判断和执行等功能。

中国象棋游戏设计

中国象棋游戏设计

JIU JIANG UNIVERSITY毕业设计题目中国象棋游戏设计英文题目Chinese Chess Game Design院系信息科学与技术学院专业信息管理与信息系统姓名林传玉班级学号 A102215 指导教师杨桃二O一四年五月摘要中国象棋游戏系统是以C/S架构为基础开发的对弈软件,以灵活独立的Java语言为主要开发工具,其中多线程、JavaSwing、Socket编程以及数组和字符串的运用等技术都在开发过程中有所涉猎。

在计算机广泛普及的背景之下,中国象棋游戏解决了由时间、地域和对手有限等面对面对弈所产生的问题,给人们带来很多方便。

对于象棋游戏的研究,通过棋盘类的开发实现棋盘模块,从移动区域、移动规则两个方面详细研究并描述象棋七类棋子的基本属性和棋子走法。

另外,通过对系统的运行测试,表明系统除了实现基于Java技术的中国象棋游戏行棋规则算法,得以使每个棋子的行棋路线都严格遵循棋子属性所具备的走棋规则之外,还具有悔棋、计时、求和、认输等功能,而系统本身也具备界面朴素,操作简便,运行稳定的特点。

系统虽然调试完成,但是仍有许多不足之处,比如没有实现人机对弈,没有聊天记录的本机储存等功能。

不过,随着开发经验的积累,系统的缺陷和不足将会逐步得到完善。

关键词:中国象棋,设计,软件,多线程,信息技术AbstractChinese chess game system is a game software which is developed on the basis of C/S architecture, and using the flexible independent Java language as the main development tools, multi-threading, JavaSwing, Socket programming as well as array and character string are dabbled in the process of development in technology.Under the broad background of the network, the problems resulting from face to face rival game, like the limits of time, region and opponents etc, are solved, to bring a lot of convenience. For the study of chess games, board module achieved through the development of boards, study and describe the basic properties and pawn moves of the seven categories of chess from two aspects of mobile area and moving rules. Furthermore, through the operation tests of the system, it shows that in addition to realize the Chinese chess game moves rules algorithm based on Java technology, so that each piece moves on line strictly follow pieces attribute of the rules of playing chess, the system also has undo, timing, summation, throw in the towel and other functions, and the system itself has characteristics of simple interface, easy operation and stable operation.While System debugging is completed, but there are still many deficiencies, such as no man-machine chess, no chats local storage and other functions. However, with the accumulation of development experience, and gradually perfect the flaw and the insufficiency of the system is imperative.Keywords: Chinese Chess, Design, Software, Muiti Theard, Information Technology目录摘要 (I)Abstract (II)1 绪论1.1 课题背景 (1)1.2 课题研究的内容与意义 (2)1.3 技术思路 (3)1.4 本章小结 (4)2 系统分析2.1 可行性分析 (5)2.2 系统功能模块分析 (6)2.3 需求分析 (7)2.4 本章小结 (10)3 系统设计3.1 中国象棋游戏的结构设计 (11)3.2 系统的功能模块设计 (13)3.3 走棋和吃棋规则设计 (14)3.4 主要算法伪码示例 (18)3.5 本章小结 (22)4 系统运行测试4.1 服务端和客户端运行测试 (23)4.2 客户端和客户端运行测试 (25)4.3 本章小结 (29)5 总结与展望5.1 全文总结 (30)5.2 研究展望 (30)致谢 (32)参考文献 (33)1 绪论1.1 课题背景中国象棋作为我国的十大“国粹”之一,其爱好者不计其数。

java课程设计中国象棋

java课程设计中国象棋

象棋程序设计1.课程设计目的Java语言是当今流行的网络编程语言,它具有面向对象、跨平台、分布应用等特点。

面向对象的开发方法是当今世界最流行的开发方法,它不仅具有更贴近自然的语义,而且有利于软件的维护和继承,很好的融合了“面向对象”、“跨平台”和“编程简洁”等特性。

随着Java语言的不断发展,它的应用前景将更为宽阔。

本课程设计主要是使用Swing这个Java自带的图形开发工具实现中国象棋棋子及棋盘的绘制,并根据相应的象棋规则,实现在电脑上虚拟出可以供两个人对弈的象棋游戏,从而达到了进一步巩固课堂上所学到的知识,深刻把握Java语言的重要概念及其面向对象的特性,熟练的应用面向对象的思想和设计方法解决实际问题的能力的目的。

2.设计方案论证2.1程序功能象棋是中国一种流传十分广泛的游戏。

下棋双方根据自己对棋局形式的理解和对棋艺规律的掌握,调动车马,组织兵力,协调作战在棋盘--这块特定的战场上进行着象征性的军事战斗。

本程序的功能就是将棋盘和棋子在电脑上模拟出来,双方可以通过鼠标对己方棋子的操作进行对弈。

2.2设计思路象棋,人人会走,把己方的棋子按不同棋子的规则放在棋盘合适的位置上。

象棋包含三个要素:棋盘、棋子和规则。

在本象棋程序的设计上,也大致遵循这三个要素,但是细化为四个方面:棋盘、棋盘上可以走棋的落子点、棋子和象棋规则。

棋盘其实就是一张棋盘的图形,我们要在计算机上的棋盘上落子并不像在现实生活中那么容易,这里说的棋盘充其量只是背景,真正落子的地方必须是我们在图形界面上设定的落子点,不同棋子只能按照各自的规则在这些设定的位置上摆放、搏杀。

2.3设计方法根据前面的细化,程序中分别设计了四个类对应棋盘、落子点、棋子和象棋规则这四个方面。

四个类几乎包括了程序的全部,程序框图如下图所示:图1 程序功能框图2.4详细设计 2.4.1棋子类ChessSwing 中并没有棋子这个组建类,所以我们必须设计一个组件,棋子其实就是圆形 的JLabel ,但Swing 中的JLabel 组件是方形的,没关系,利用JLabel 我们可以创建 圆形的JLabel 组件——Chess 。

中国象棋(代码)

中国象棋(代码)

中国象棋(web版源代码)程序:using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class WebForm1 : System.Web.UI.Page{int tru = 20;int fals = 40;public ImageButton[,] _Image=new ImageButton[11,10];//将上一次点击点的坐标保存到数据库中的lastx和lastypublic void SaveToLast(){if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 20){int x, y, lastx, lasty;x = Getpointx();y = Getpointy();lastx = x;lasty = y;Updatalastx(lastx);Updatalasty(lasty);}if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 20){int x, y, lastx, lasty;x = Getpointx();y = Getpointy();lastx = x;lasty = y;Updatalastx(lastx);Updatalasty(lasty);}}//将棋盘上所有棋子图片显示到棋盘上private void _Drawqizi(){//_Init();int i,j,k;if (_GetUserState("red") != 0 && _GetUserState("black") != 0){if (Session["user"].ToString() == "red"){for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){k = _GetDataQipan(i, j);_Image[i, j].ImageUrl = _GetImageAdd(k);}}if (Session["user"].ToString() == "black"){for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){k = _GetDataQipan(i, j);_Image[11 - i, 10 - j].ImageUrl =_GetImageAdd(k);}}}//初始化:对_Image[,]赋值,对ImageButton进行编号private void _Init(){_Image[1, 1] = ImageButton1; _Image[1, 2] = ImageButton2; _Image[1, 3] = ImageButton3; _Image[1, 4] = ImageButton4; _Image[1, 5] = ImageButton5; _Image[1, 6] = ImageButton6; _Image[1, 7] = ImageButton7; _Image[1, 8] = ImageButton8; _Image[1, 9] = ImageButton9;_Image[2, 1] = ImageButton11; _Image[2, 2] = ImageButton12; _Image[2, 3] = ImageButton13; _Image[2, 4] = ImageButton14; _Image[2, 5] = ImageButton15; _Image[2, 6] = ImageButton16; _Image[2, 7] = ImageButton17; _Image[2, 8] = ImageButton18; _Image[2, 9] = ImageButton19;_Image[3, 1] = ImageButton21; _Image[3, 2] = ImageButton22; _Image[3, 3] = ImageButton23; _Image[3, 4] = ImageButton24; _Image[3, 5] = ImageButton25; _Image[3, 6] = ImageButton26; _Image[3, 7] = ImageButton27; _Image[3, 8] = ImageButton28; _Image[3, 9] = ImageButton29;_Image[4, 1] = ImageButton31; _Image[4, 2] = ImageButton32; _Image[4, 3] = ImageButton33; _Image[4, 4] = ImageButton34; _Image[4, 5] = ImageButton35; _Image[4, 6] = ImageButton36; _Image[4, 7] = ImageButton37; _Image[4, 8] = ImageButton38; _Image[4, 9] = ImageButton39;_Image[5, 1] = ImageButton41; _Image[5, 2] = ImageButton42; _Image[5, 3] = ImageButton43; _Image[5, 4] = ImageButton44; _Image[5, 5] = ImageButton45; _Image[5, 6] = ImageButton46; _Image[5, 7] = ImageButton47; _Image[5, 8] = ImageButton48; _Image[5, 9] = ImageButton49;_Image[6, 1] = ImageButton51; _Image[6, 2] = ImageButton52; _Image[6, 3] = ImageButton53; _Image[6, 4] = ImageButton54; _Image[6, 5] = ImageButton55; _Image[6, 6] = ImageButton56; _Image[6, 7] = ImageButton57; _Image[6, 8] = ImageButton58; _Image[6, 9] = ImageButton59;_Image[7, 1] = ImageButton61; _Image[7, 2] = ImageButton62; _Image[7, 3] = ImageButton63; _Image[7, 4] = ImageButton64; _Image[7, 5] = ImageButton65; _Image[7, 6] = ImageButton66; _Image[7, 7] = ImageButton67; _Image[7, 8] = ImageButton68; _Image[7, 9] = ImageButton69;_Image[8, 1] = ImageButton71; _Image[8, 2] = ImageButton72; _Image[8, 3] = ImageButton73; _Image[8, 4] = ImageButton74; _Image[8, 5] = ImageButton75; _Image[8, 6] = ImageButton76; _Image[8, 7] = ImageButton77; _Image[8, 8] = ImageButton78; _Image[8, 9] = ImageButton79;_Image[9, 1] = ImageButton81; _Image[9, 2] = ImageButton82; _Image[9, 3] = ImageButton83; _Image[9, 4] = ImageButton84; _Image[9, 5] = ImageButton85; _Image[9, 6] = ImageButton86; _Image[9, 7] = ImageButton87; _Image[9, 8] = ImageButton88; _Image[9, 9] = ImageButton89;_Image[10, 1] = ImageButton91; _Image[10, 2] = ImageButton92; _Image[10, 3] = ImageButton93; _Image[10, 4] = ImageButton94; _Image[10, 5] = ImageButton95; _Image[10, 6] = ImageButton96; _Image[10, 7] = ImageButton97; _Image[10, 8] = ImageButton98; _Image[10, 9] = ImageButton99;int i, j;for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){_Image[i, j].ImageUrl = "~/image/back.gif";}}//初始化棋盘,将两方棋子放好位private void _InitQizi(){int i = 0, j = 0, k = 0;int[] initqipandata = new int[37];for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){_UpdataQipan(i, j, k);}for (i = 0; i <= 36; i++)initqipandata[i] = i;_UpdataQipan(1, 1, initqipandata[8]); _UpdataQipan(1, 2, initqipandata[6]); _UpdataQipan(1, 3, initqipandata[4]); _UpdataQipan(1, 4, initqipandata[2]); _UpdataQipan(1, 5, initqipandata[1]); _UpdataQipan(1,6, initqipandata[3]); _UpdataQipan(1, 7, initqipandata[5]); _UpdataQipan(1, 8, initqipandata[7]); _UpdataQipan(1, 9, initqipandata[9]); _UpdataQipan(3, 2, initqipandata[10]); _UpdataQipan(3, 8, initqipandata[11]); _UpdataQipan(4, 1, initqipandata[12]); _UpdataQipan(4, 3, initqipandata[13]);_UpdataQipan(4, 5, initqipandata[14]); _UpdataQipan(4, 7,initqipandata[15]); _UpdataQipan(4, 9, initqipandata[16]);_UpdataQipan(10, 1, initqipandata[28]); _UpdataQipan(10, 2, initqipandata[26]); _UpdataQipan(10, 3, initqipandata[24]);_UpdataQipan(10, 4, initqipandata[22]); _UpdataQipan(10, 5,initqipandata[21]); _UpdataQipan(10, 6, initqipandata[23]);_UpdataQipan(10, 7, initqipandata[25]); _UpdataQipan(10, 8,initqipandata[27]); _UpdataQipan(10, 9, initqipandata[29]); _UpdataQipan(8, 2, initqipandata[30]); _UpdataQipan(8, 8, initqipandata[31]);_UpdataQipan(7, 1, initqipandata[32]); _UpdataQipan(7, 3,initqipandata[33]); _UpdataQipan(7, 5, initqipandata[34]); _UpdataQipan(7, 7, initqipandata[35]); _UpdataQipan(7, 9, initqipandata[36]);}//获取棋子图片地址private string _GetImageAdd(int xxx){string x="" ;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select add_image from qizi where(no_qizi='"+xxx+"');", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())x = sr["add_image"].ToString();//Session["add_image"] = x;myconn.Close();return x;}//获取点击后的图片地址private string _GetImageDownAdd(int xxx){string x ="";SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select add_image_down from qizi where(no_qizi='" + xxx + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())x = sr["add_image_down"].ToString();myconn.Close();return x;}//读取鼠标点击点的坐标private int Getpointx(){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select x from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["x"].ToString());}myconn.Close();return x;}private int Getpointy( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select y from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["y"].ToString());}myconn.Close();return x;}private int Getpointlastx( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select lastx from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["lastx"].ToString());}myconn.Close();return x;}private int Getpointlasty( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select lasty from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["lasty"].ToString());}myconn.Close();return x;}//写入鼠标点击点的坐标private void Updatax(int xxx){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set x='" + xxx + "'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatay(int yyy){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set y='" + yyy + "'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatalastx(int lastxxx){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set lastx='"+lastxxx +"'" , myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatalasty(int lastyyy){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set lasty='"+ lastyyy +"'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//以上四个函数的集合,达到一次写入四个坐标值的目的private void _UpdataaZuobiao(int xxx, int yyy, int lastxxx, int lastyyy){Updatax(xxx);Updatay(yyy);Updatalastx(lastxxx);Updatalasty(lastyyy);}//保存当前坐标值到x和yprivate void _UpdatZuobiaoXY(int xxx, int yyy){if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 20){Updatax(xxx);Updatay(yyy);}if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 20){Updatax(xxx);Updatay(yyy);}}//读取棋盘上的棋子信息private int _GetDataQipan(int xxx, int yyy){int i,data=0;i = (xxx - 1) * 9 + yyy;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select data_qipan from qipan where(position='"+i+"')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["data_qipan"].ToString());myconn.Close();return data;}//将棋子信息写入棋盘private void _UpdataQipan(int xxx, int yyy,int data){int i;i = (xxx - 1) * 9 + yyy;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update qipan set data_qipan=" + data + "where (position='"+i+"')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//读出用户此时状态private int _GetUserState(string id){int data = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select state from yonghu where(id='" + id + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["state"].ToString());myconn.Close();return data;}//读出用户输赢状态 0表示在进行游戏 20表示赢 40表示输private int _GetUserWin(string id){int data = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select winner from yonghu where(id='" + id + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["winner"].ToString());myconn.Close();return data;}//写入用户状态private void _UpdataUserState(string id,int sta){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update yonghu set state="+ sta + "where (id='" + id + "')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//写入用户输赢状态 0表示在进行游戏 20表示赢 40表示输private void _UpdataUserWin(string id, int sta){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update yonghu set winner=" + sta + "where (id='" + id + "')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}protected void Page_Load(object sender, EventArgs e){_Init();// _Test();}//测试程序函数private void _Test(){_UpdataUserState("red",tru);_UpdataUserState("black", tru);}private bool_IsAbleToPut()//********************************************************需要传递x,y,laastx,lasty{if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 40)return false;if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 40)return false;int x, y, lastx, lasty;int qipandata,lastqipandata;x = Getpointx();y = Getpointy();lastx = Getpointlastx();lasty = Getpointlasty();if (Session["user"].ToString() == "black"){x = 11 - x;y = 10 - y;lastx = 11 - lastx;lasty = 10 - lasty;}qipandata = _GetDataQipan(x, y);lastqipandata = _GetDataQipan(lastx, lasty);// if (lastqipandata==0)// return false;if(Session["user"].ToString() == "red"&&(lastqipandata <= 20 || qipandata >=20))//****************************************************************现以红方为对象return false;if (Session["user"].ToString() == "black" && ((lastqipandata == 0 || lastqipandata >= 20) || (qipandata > 0 && qipandata <= 20)))return false;int i, j, c;//将|帅if (lastqipandata == 1 || lastqipandata == 21){if ((x - lastx) * (y - lasty) != 0) return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1) return false;if (y < 4 || y > 6 || (x > 3 && x < 8)) return false;return true;}//士|仕if (lastqipandata == 2 || lastqipandata == 3 || lastqipandata == 22 || lastqipandata == 23){if ((x - lastx) * (y - lasty) == 0) return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1) return false;if (y < 4 || y > 6 || (x > 3 && x < 8)) return false;return true;}//象|相if (lastqipandata == 4 || lastqipandata == 5 || lastqipandata == 24 || lastqipandata == 25){if ((x - lastx) * (y - lasty) == 0) return false;if (Math.Abs(x - lastx) != 2 || Math.Abs(y - lasty) != 2) return false;if(Session["user"].ToString() == "red"&& x < 6) return false;if (Session["user"].ToString() == "black" && x > 5) return false;i = 0; j = 0;//i,j必须有初始值if (x - lastx == 2){i = x - 1;}if (x - lastx == -2){i = x + 1;}if (y - lasty == 2){j = y - 1;}if (y - lasty == -2){j = y + 1;}if (_GetDataQipan(i, j) != 0) return false;return true;}//马if (lastqipandata == 6 || lastqipandata == 7 || lastqipandata == 26 || lastqipandata == 27){if (Math.Abs(x - lastx) * Math.Abs(y - lasty) != 2)return false;if (x - lastx == 2){if (_GetDataQipan(x - 1, lasty) != 0)return false;}if (x - lastx == -2){if (_GetDataQipan(x + 1, lasty) != 0)return false;}if (y - lasty == 2){if (_GetDataQipan(lastx, y - 1) != 0)return false;}if (y - lasty == -2){if (_GetDataQipan(lastx, y + 1) != 0)return false;}return true;}//车if (lastqipandata == 8 || lastqipandata == 9 || lastqipandata == 28 || lastqipandata == 29){//判断是否直线if ((x - lastx) * (y - lasty) != 0) return false;//判断是否隔有棋子if (x != lastx){if (lastx > x) { int t = x; x = lastx; lastx = t; }for (i = lastx; i <= x; i += 1){if (i != x && i != lastx){if (_GetDataQipan(i, y) != 0)return false;}}}if (y != lasty){if (lasty > y) { int t = y; y = lasty; lasty = t; }for (j = lasty; j <= y; j += 1){if (j != y && j != lasty){if (_GetDataQipan(x, j) != 0)return false;}}}return true;}//炮if (lastqipandata == 10 || lastqipandata == 11 || lastqipandata == 30 || lastqipandata == 31){bool swapflagx = false;bool swapflagy = false;if ((x - lastx) * (y - lasty) != 0) return false;c = 0;if (x != lastx){if (lastx > x) { int t = x; x = lastx; lastx = t; swapflagx = true; }for (i = lastx; i <= x; i += 1){if (i != x && i != lastx){if (_GetDataQipan(i, y) != 0)c = c + 1;//IsAbleToPut = False: Exit Function}}}if (y != lasty){if (lasty > y) { int t = y; y = lasty; lasty = t; swapflagy = true; }for (j = lasty; j <= y; j += 1){if (j != y && j != lasty){if (_GetDataQipan(x, j) != 0)c = c + 1;//IsAbleToPut = False: Exit Function}}}if (c > 1) return false; //与目标处间隔1个以上棋子if (c == 0) //与目标处无间隔棋子{if(swapflagx == true) { int t = x; x = lastx; lastx = t; }if(swapflagy == true) { int t = y; y = lasty; lasty = t; }if (_GetDataQipan(x, y) != 0) return false;}if (c == 1)//与目标处间隔1个棋子{if(swapflagx == true) { int t = x; x = lastx; lastx = t; }if(swapflagy == true) { int t = y; y = lasty; lasty = t; }// if ((IsMyChess(qipan[x, y]) || qipan[x, y] == 0))//return false;//***********ismychess************************************************** ***************************if (qipandata == 0)return false;}return true;}//卒|兵if (lastqipandata == 12 || lastqipandata == 13 || lastqipandata == 14 || lastqipandata == 15 || lastqipandata == 16 || lastqipandata == 32 || lastqipandata == 33 || lastqipandata == 34 || lastqipandata == 35 || lastqipandata == 36){if ((x - lastx) * (y - lasty) != 0)return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1)return false;if (Session["user"].ToString() == "red" && (x >= 6 && (y - lasty) != 0)) return false;if(Session["user"].ToString() == "black"&& (x <= 5 && (y - lasty) != 0)) return false;if(Session["user"].ToString() == "red"&& (x - lastx > 0)) return false;if(Session["user"].ToString() == "black"&& (x - lastx < 0)) return false;return true;}return false;}//移动棋子private void _MoveChess()//********************************************************需要传递x,y,laastx,lasty{//如果能移动则移动棋子if (_IsAbleToPut()){int x, y, lastx, lasty,qipandata, lastqipandata, tr;tr = 0;x = Getpointx();y = Getpointy();lastx = Getpointlastx();lasty = Getpointlasty();if (Session["user"].ToString() == "black"){x = 11 - x;y = 10 - y;lastx = 11 - lastx;lasty = 10 - lasty;}qipandata = _GetDataQipan(x, y);lastqipandata = _GetDataQipan(lastx, lasty);_UpdataQipan(x, y, lastqipandata);_UpdataQipan(lastx, lasty, tr);if (Session["user"].ToString() == "red"){_UpdataUserState("red", fals);_UpdataUserState("black", tru);}if (Session["user"].ToString() == "black"){_UpdataUserState("red", tru);_UpdataUserState("black", fals);}if (qipandata == 1){Response.Write("<script language=javascript>alert('恭喜您,您赢啦');</script>");_UpdataUserState("red", fals);_UpdataUserState("black", fals);Button6.Enabled = true;_UpdataUserWin("red",20);_UpdataUserWin("black", 40);}if (qipandata == 21){Response.Write("<script language=javascript>alert('恭喜您,您赢啦');</script>");_UpdataUserState("red", fals);_UpdataUserState("black", fals);Button6.Enabled = true;_UpdataUserWin("red", 40);_UpdataUserWin("black", 20);}_UpdataaZuobiao(0, 0, 0, 0);}//如果不能移动则更换已方被点击棋子的背景图片}protected void ImageButton1_Click1(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton2_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton3_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton4_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton5_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton6_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton7_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton8_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton9_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton11_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton12_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 2; _UpdatZuobiaoXY(x, y);_MoveChess(); _Drawqizi();}protected void ImageButton13_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton14_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton15_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton16_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton17_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton18_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton19_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton21_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton22_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton23_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton24_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton25_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton26_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton27_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton28_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton29_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton31_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton32_Click(object sender,ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton33_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton34_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton35_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton36_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton37_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}。

Excel制作五子棋vba源代码

Excel制作五子棋vba源代码

Excel制作象棋vba源代码' The algorithm of judge and urgentpoint function are exported from one VC program which I downloaded from web.' Sorry I can't remebered the program and the author name.' The original VC program have three options for different level. I simplized it to the hardest one in this VBA sample.'Dim m_Board(17, 17) As IntegerPrivate Type Cpointx As Integery As IntegerEnd TypeDim m_nType As IntegerDim iWho As IntegerPrivate Sub Excelba_Click()End SubPrivate Sub cmdStart_Click()Cells(17, 1) = "Start"Cells(17, 3) = 0 ' total number of stones'clear the boardRange(Cells(17 + 1, 1), Cells(17 + 15, 15)).Value = 0'clear all picture in this sheet except for two orginal pictureFor Each ipic In ActiveSheet.ShapesIf <> "Picture 9" And <> "Picture 10" And Left(, 7) = "Picture" Thenipic.DeleteEnd IfNext'start itIf optComputer.Value = True ThenCall drawit(8, 8, 1)Call setarray(8, 8, 1)Cells(17, 3) = 1End IfEnd SubPrivate Sub optComputer_Click()Cells(17, 1) = ""Cells(17, 2) = 2Cells(17, 3) = 0End SubPrivate Sub optYou_Click()Cells(17, 1) = ""Cells(17, 2) = 1Cells(17, 3) = 0End SubPrivate Function confArray(ix As Integer, iy As Integer) As IntegerconfArray = Cells(17 + ix, iy)End FunctionPrivate Sub setarray(ix As Integer, iy As Integer, iz As Integer)Cells(17 + ix, iy) = izEnd SubPrivate Sub drawit(ix As Integer, iy As Integer, iz As Integer)Dim strP As StringIf ix < 1 Or ix > 15 Or iy < 1 Or iy > 15 Or iz < 1 Or iz > 2 ThenMsgBox "Wrong Entry Number, please check it!", vbCritical, "Wrong Entry"EndEnd IfIf iz = 1 ThenstrP = "Picture 9"ElseIf iz = 2 ThenstrP = "Picture 10"End IfApplication.ScreenUpdating = FalseActiveSheet.Shapes(strP).SelectSelection.CopyCells(16, 4).SelectActiveSheet.Paste-(Selection.Left - Cells(ix, iy).Left) + 1-(Selection.Top - Cells(ix, iy).Top) + 1Cells(17, 4).SelectApplication.ScreenUpdating = TrueEnd SubPrivate Function UrgentPoint(ByVal iz As Integer) As StringDim i, i0, j, j0 As IntegerDim ptUrgent(2025) As CpointDim nGrade1 As IntegerDim nGrade2 As IntegerDim nUrgent1 As IntegerDim nUrgent2 As IntegerDim nUrgent As IntegerDim iEnd As IntegerDim iStep As IntegerDim jEnd As IntegerDim jStep As IntegerFor i = 0 To 2024ptUrgent(i).x = -1ptUrgent(i).y = -1Next iIf ((Rnd() * 32767) Mod 2) = 0 Theni0 = 0Elsei0 = 14End IfIf i0 = 0 TheniEnd = 14iStep = 1ElseiEnd = 0iStep = -1End IfFor i = i0 To iEnd Step iStepIf ((Rnd() * 32767) Mod 2) = 0 Thenj0 = 0Elsej0 = 14End IfIf j0 = 0 ThenjEnd = 14jStep = 1ElsejEnd = 0jStep = -1End IfFor j = j0 To jEnd Step jStepIf (m_Board(i, j) = 0) ThennGrade1 = Judge(i, j, iz)nGrade2 = Judge(i, j, iz + 1)Select Case (nGrade1)Case 0nUrgent1 = 0Case 1nUrgent1 = 2Case 2nUrgent1 = 4Case 3nUrgent1 = 5Case 4nUrgent1 = 8Case 5nUrgent1 = 10Case 6nUrgent1 = 11nUrgent1 = 12 Case 8nUrgent1 = 13 Case 9nUrgent1 = 14 Case 10nUrgent1 = 15 Case 11nUrgent1 = 16 Case 12nUrgent1 = 17 Case 13nUrgent1 = 18 Case 14nUrgent1 = 19 Case 15nUrgent1 = 20 Case 16nUrgent1 = 32 Case 17nUrgent1 = 34 Case 18nUrgent1 = 36 Case 19nUrgent1 = 38 Case 20nUrgent1 = 40 Case ElsenUrgent1 = 40 End SelectSelect Case (nGrade2)Case 0nUrgent2 = 1 Case 1nUrgent2 = 3 Case 2nUrgent2 = 6 Case 3nUrgent2 = 7 Case 4nUrgent2 = 9 Case 5nUrgent2 = 21nUrgent2 = 22Case 7nUrgent2 = 23Case 8nUrgent2 = 24Case 9nUrgent2 = 25Case 10nUrgent2 = 26Case 11nUrgent2 = 27Case 12nUrgent2 = 28Case 13nUrgent2 = 29Case 14nUrgent2 = 30Case 15nUrgent2 = 31Case 16nUrgent2 = 33Case 17nUrgent2 = 35Case 18nUrgent2 = 37Case 19nUrgent2 = 39Case 20nUrgent2 = 41Case ElsenUrgent2 = 41End SelectnUrgent = WorksheetFunction.Min(nUrgent1, nUrgent2) * 45 + WorksheetFunction.Max(nUrgent1, nUrgent2)ptUrgent(nUrgent).x = iptUrgent(nUrgent).y = jEnd IfNext jNext iFor i = 0 To 2024If ((ptUrgent(i).x <> -1) And (ptUrgent(i).y <> -1)) ThenExit ForEnd IfNext iIf (ptUrgent(i).x = -1 And ptUrgent(i).y = -1) ThenMsgBox "Make Draw"End IfUrgentPoint = ptUrgent(i).x & "|" & ptUrgent(i).yEnd FunctionPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)Dim ix As IntegerDim iy As IntegerDim iz As IntegerDim ix1 As IntegerDim iy1 As IntegerDim stmp As StringDim i As IntegerDim j As IntegerIf > 1 Or Target.Areas(1).Columns.Count > 1 Or Target.Areas(1).Rows.Count > 1 Then Exit SubEnd Ifix = Target.Areas(1).Rowiy = Target.Areas(1).Columniz = confArray(ix, iy)If ix > 15 Or iy > 15 ThenExit SubEnd IfIf iz <> 1 And iz <> 2 And Cells(17, 1) = "Start" ThenFor i = 0 To 14For j = 0 To 14m_Board(j, i) = Cells(17 + i + 1, j + 1)Next jNext iCall drawit(ix, iy, 2)Call setarray(ix, iy, 2)m_Board(iy - 1, ix - 1) = 2Call Judge(iy - 1, ix - 1, 2)Call ringIf Cells(17, 1) = "Start" Thenstmp = UrgentPoint(1)iy1 = Left(stmp, InStr(1, stmp, "|") - 1)ix1 = Mid(stmp, InStr(1, stmp, "|") + 1)Call drawit(ix1 + 1, iy1 + 1, 1)Call setarray(ix1 + 1, iy1 + 1, 1)m_Board(iy1, ix1) = 1Call Judge(iy1, ix1, 1)Call ringEnd IfEnd IfEnd SubPrivate Function Judge(ByVal nX As Integer, ByVal nY As Integer, ByVal cValue As Integer) As IntegerDim nGrade As IntegerDim i As IntegerDim j As IntegerDim k As IntegerDim l As IntegerDim nXStart As IntegerDim nXEnd As IntegerDim nYStart As IntegerDim nYEnd As IntegerDim nXYStart As IntegerDim nXYEnd As IntegerDim nYXStart As IntegerDim nYXEnd As IntegerDim nXStartAdd As IntegerDim nYStartAdd As IntegerDim nXYStartAdd As IntegerDim nYXStartAdd As IntegerDim nXEndAdd As IntegerDim nYEndAdd As IntegerDim nXYEndAdd As IntegerDim nYXEndAdd As IntegerDim bXStartEmpty As BooleanDim bXEndEmpty As BooleanDim bXStartEmpty1 As BooleanDim bXEndEmpty1 As BooleanDim bYStartEmpty As BooleanDim bYEndEmpty As BooleanDim bYStartEmpty1 As BooleanDim bYEndEmpty1 As BooleanDim bXYStartEmpty As BooleanDim bXYEndEmpty As BooleanDim bXYStartEmpty1 As BooleanDim bXYEndEmpty1 As BooleanDim bYXStartEmpty As BooleanDim bYXEndEmpty As BooleanDim bYXStartEmpty1 As BooleanDim bYXEndEmpty1 As BooleannXStart = nXnXEnd = nXnYStart = nYnYEnd = nYnXYStart = nXnXYEnd = nXnYXStart = nXnYXEnd = nXnXStartAdd = 0nYStartAdd = 0nXYStartAdd = 0nYXStartAdd = 0nXEndAdd = 0nYEndAdd = 0nXYEndAdd = 0nYXEndAdd = 0bXStartEmpty = FalsebYStartEmpty = FalsebXYStartEmpty = FalsebYXStartEmpty = FalsebXEndEmpty = FalsebYEndEmpty = FalsebXYEndEmpty = FalsebYXEndEmpty = FalsebXStartEmpty1 = FalsebYStartEmpty1 = FalsebXYStartEmpty1 = FalsebYXStartEmpty1 = FalsebXEndEmpty1 = FalsebYEndEmpty1 = FalsebXYEndEmpty1 = FalsebYXEndEmpty1 = FalseFor i = nX - 1 To 0 Step -1 ' <-If m_Board(i, nY) = cV alue ThennXStart = iElseIf m_Board(i, nY) = 0 ThenbXStartEmpty = TrueFor j = i - 1 To 0 Step -1 ' <-If m_Board(j, nY) = cValue ThennXStartAdd = i - jElseIf m_Board(j, nY) = 0 ThenbXStartEmpty1 = TrueExit ForElseExit ForEnd IfNext jExit ForElseExit ForEnd IfNext iFor i = nX + 1 To 14 ' ->If m_Board(i, nY) = cV alue ThennXEnd = iElseIf m_Board(i, nY) = 0 ThenbXEndEmpty = TrueFor j = i + 1 To 14 ' ->If m_Board(j, nY) = cValue ThennXEndAdd = j - iElseIf m_Board(j, nY) = 0 ThenbXEndEmpty1 = TrueExit ForElseExit ForEnd IfNext jExit ForElseExit ForEnd IfNext iFor i = nY - 1 To 0 Step -1 ' ^|^If m_Board(nX, i) = cV alue ThennYStart = iElseIf m_Board(nX, i) = 0 ThenbYStartEmpty = TrueFor j = i - 1 To 0 Step -1 ' <-If m_Board(nX, j) = cValue ThennYStartAdd = i - jElseIf m_Board(nX, j) = 0 ThenbYStartEmpty1 = TrueExit ForElseExit ForEnd IfNext jExit ForElseExit ForEnd IfNext iFor i = nY + 1 To 14 ' v|vIf m_Board(nX, i) = cV alue ThennYEnd = iElseIf m_Board(nX, i) = 0 ThenbYEndEmpty = TrueFor j = i + 1 To 14 ' ->If m_Board(nX, j) = cValue ThennYEndAdd = j - iElseIf m_Board(nX, j) = 0 ThenbYEndEmpty1 = TrueExit ForElseExit ForEnd IfNext jExit ForElseExit ForEnd IfNext ii = nX - 1j = nY + 1Do While i >= 0 And j < 15'j++If m_Board(i, j) = cValue ThennXYStart = iElseIf m_Board(i, j) = 0 ThenbXYStartEmpty = Truek = i - 1l = j + 1Do While k >= 0 And l < 15If m_Board(k, l) = cValue ThennXYStartAdd = i - kElseIf m_Board(k, l) = 0 ThenbXYStartEmpty1 = TrueExit DoElseExit DoEnd Ifk = k - 1l = l + 1LoopElseExit DoEnd Ifi = i - 1j = j + 1Loopi = nX + 1j = nY - 1Do While i < 15 And j >= 0'j--If m_Board(i, j) = cValue ThennXYEnd = iElseIf m_Board(i, j) = 0 ThenbXYEndEmpty = Truek = i + 1l = j - 1Do While l >= 0 And k < 15If m_Board(k, l) = cValue ThennXYEndAdd = i - kElseIf m_Board(k, l) = 0 ThenbXYEndEmpty1 = TrueExit DoElseExit DoEnd Ifk = k + 1l = l - 1LoopExit DoElseExit DoEnd Ifi = i + 1j = j - 1Loopi = nX - 1j = nY - 1Do While i >= 0 And j >= 0'j--If m_Board(i, j) = cValue ThennYXStart = iElseIf m_Board(i, j) = 0 ThenbYXStartEmpty = Truel = j - 1Do While l >= 0 And k >= 0If m_Board(k, l) = cValue ThennYXStartAdd = i - kElseIf m_Board(k, l) = 0 ThenbYXStartEmpty1 = TrueExit DoElseExit DoEnd Ifk = k - 1l = l - 1LoopExit DoElseExit DoEnd Ifi = i - 1j = j - 1Loopi = nX + 1j = nY + 1Do While i < 15 And j < 15'j--If m_Board(i, j) = cValue ThennYXEnd = iElseIf m_Board(i, j) = 0 ThenbYXEndEmpty = Truek = i - 1l = j - 1Do While l < 15 And k < 15If m_Board(k, l) = cValue ThennYXEndAdd = i - kElseIf m_Board(k, l) = 0 ThenbYXEndEmpty1 = TrueExit DoElseExit DoEnd Ifk = k + 1l = l + 1LoopExit DoElseExit DoEnd Ifi = i + 1j = j + 1LoopnXStep = nXEnd - nXStart + 1nXStep = nXEnd - nXStart + 1nYStep = nYEnd - nYStart + 1nXYStep = nXYEnd - nXYStart + 1nYXStep = nYXEnd - nYXStart + 1Dim bX_4 As BooleanDim bY_4 As BooleanDim bXY_4 As BooleanDim bYX_4 As BooleanDim bX4 As BooleanDim bY4 As BooleanDim bXY4 As BooleanDim bYX4 As BooleanbX_4 = (nXStep = 4) And (bXStartEmpty And bXEndEmpty)bY_4 = (nYStep = 4) And (bYStartEmpty And bYEndEmpty)bXY_4 = (nXYStep = 4) And (bXYStartEmpty And bXYEndEmpty) bYX_4 = (nYXStep = 4) And (bYXStartEmpty And bYXEndEmpty) bX4 = (nXStep = 4) And (bXStartEmpty Or bXEndEmpty)bY4 = (nYStep = 4) And (bYStartEmpty Or bYEndEmpty)bXY4 = (nXYStep = 4) And (bXYStartEmpty Or bXYEndEmpty) bYX4 = (nYXStep = 4) And (bYXStartEmpty Or bYXEndEmpty) Dim bX_3 As BooleanDim bY_3 As BooleanDim bXY_3 As BooleanDim bYX_3 As BooleanDim bX3 As BooleanDim bY3 As BooleanDim bXY3 As BooleanDim bYX3 As BooleanbX_3 = (nXStep = 3) And (bXStartEmpty And bXEndEmpty)bY_3 = (nYStep = 3) And (bYStartEmpty And bYEndEmpty)bXY_3 = (nXYStep = 3) And (bXYStartEmpty And bXYEndEmpty) bYX_3 = (nYXStep = 3) And (bYXStartEmpty And bYXEndEmpty) bX3 = (nXStep = 3) And (bXStartEmpty Or bXEndEmpty)bY3 = (nYStep = 3) And (bYStartEmpty Or bYEndEmpty)bXY3 = (nXYStep = 3) And (bXYStartEmpty Or bXYEndEmpty) bYX3 = (nYXStep = 3) And (bYXStartEmpty Or bYXEndEmpty) Dim bX_2 As BooleanDim bY_2 As BooleanDim bXY_2 As BooleanDim bYX_2 As BooleanDim bX2 As BooleanDim bY2 As BooleanDim bXY2 As BooleanDim bYX2 As BooleanbX_2 = (nXStep = 2) And (bXStartEmpty And bXEndEmpty)bY_2 = (nYStep = 2) And (bYStartEmpty And bYEndEmpty)bXY_2 = (nXYStep = 2) And (bXYStartEmpty And bXYEndEmpty) bYX_2 = (nYXStep = 2) And (bYXStartEmpty And bYXEndEmpty) bX2 = (nXStep = 2) And (bXStartEmpty Or bXEndEmpty)bY2 = (nYStep = 2) And (bYStartEmpty Or bYEndEmpty)bXY2 = (nXYStep = 2) And (bXYStartEmpty Or bXYEndEmpty) bYX2 = (nYXStep = 2) And (bYXStartEmpty Or bYXEndEmpty) Dim bX_1 As BooleanDim bY_1 As BooleanDim bXY_1 As BooleanDim bYX_1 As BooleanbX_1 = (nXStep = 1) And (bXStartEmpty And bXEndEmpty)bY_1 = (nYStep = 1) And (bYStartEmpty And bYEndEmpty)bXY_1 = (nXYStep = 1) And (bXYStartEmpty And bXYEndEmpty) bYX_1 = (nYXStep = 1) And (bYXStartEmpty And bYXEndEmpty) Dim nXAdd As IntegerDim nYAdd As IntegerDim nXYAdd As IntegerDim nYXAdd As IntegernXAdd = 0nYAdd = 0nXYAdd = 0nYXAdd = 0If nXEndAdd >= nXStartAdd ThennXAdd = nXEndAddbXEndEmpty = bXEndEmpty1ElsenXAdd = nXStartAddbXStartEmpty = bXStartEmpty1End IfIf (nYEndAdd >= nYStartAdd) ThennYAdd = nYEndAddbYEndEmpty = bYEndEmpty1ElsenYAdd = nYStartAddbYStartEmpty = bYStartEmpty1End IfIf (nXYEndAdd >= nXYStartAdd) ThennXYAdd = nXYEndAddbXYEndEmpty = bXYEndEmpty1ElsenXYAdd = nXYStartAddbXYStartEmpty = bXYStartEmpty1End IfIf (nYXEndAdd >= nYXStartAdd) ThennYXAdd = nYXEndAddbYXEndEmpty = bYXEndEmpty1ElsenYXAdd = nYXStartAddbYXStartEmpty = bYXStartEmpty1End IfDim b1X_4 As BooleanDim b1Y_4 As BooleanDim b1XY_4 As BooleanDim b1YX_4 As BooleanDim b1X4 As BooleanDim b1Y4 As BooleanDim b1XY4 As BooleanDim b1YX4 As Booleanb1X_4 = (nXStep + nXAdd >= 4) And (bXStartEmpty And bXEndEmpty)b1Y_4 = (nYStep + nY Add >= 4) And (bYStartEmpty And bYEndEmpty)b1XY_4 = (nXYStep + nXYAdd >= 4) And (bXYStartEmpty And bXYEndEmpty) b1YX_4 = (nYXStep + nYXAdd >= 4) And (bYXStartEmpty And bYXEndEmpty) b1X4 = (nXStep + nXAdd >= 4) And (bXStartEmpty Or bXEndEmpty)b1Y4 = (nYStep + nY Add >= 4) And (bYStartEmpty Or bYEndEmpty)b1XY4 = (nXYStep + nXY Add >= 4) And (bXYStartEmpty Or bXYEndEmpty)b1YX4 = (nYXStep + nYXAdd >= 4) And (bYXStartEmpty Or bYXEndEmpty) Dim b1X_3 As BooleanDim b1Y_3 As BooleanDim b1XY_3 As BooleanDim b1YX_3 As Booleanb1X_3 = (nXStep + nXAdd >= 3) And (bXStartEmpty And bXEndEmpty)b1Y_3 = (nYStep + nY Add >= 3) And (bYStartEmpty And bYEndEmpty)b1XY_3 = (nXYStep + nXYAdd >= 3) And (bXYStartEmpty And bXYEndEmpty) b1YX_3 = (nYXStep + nYXAdd >= 3) And (bYXStartEmpty And bYXEndEmpty) m_nType = -1'////////If (nXStep >= 5) Or (nYStep >= 5) Or (nXYStep >= 5) Or (nYXStep >= 5) Then nGrade = 0m_nType = 0ElseIf (bX_4 Or bY_4 Or bXY_4 Or bYX_4) ThennGrade = 1m_nType = 1ElseIf ((bX4 And (bY4 Or bXY4 Or bYX4 Or b1Y4 Or b1XY4 Or b1YX4)) Or _(bY4 And (bX4 Or bXY4 Or bYX4 Or b1X4 Or b1XY4 Or b1YX4)) Or _(bXY4 And (bY4 Or bX4 Or bYX4 Or b1Y4 Or b1X4 Or b1YX4)) Or _(bYX4 And (bY4 Or bXY4 Or bX4 Or b1Y4 Or b1XY4 Or b1X4)) Or _(b1X4 And (bY4 Or bXY4 Or bYX4 Or b1Y4 Or b1XY4 Or b1YX4)) Or _(b1Y4 And (bX4 Or bXY4 Or bYX4 Or b1X4 Or b1XY4 Or b1YX4)) Or _(b1XY4 And (bY4 Or bX4 Or bYX4 Or b1Y4 Or b1X4 Or bYX4)) Or _(b1YX4 And (bY4 Or bXY4 Or bX4 Or b1Y4 Or b1XY4 Or b1X4))) Then nGrade = 2m_nType = 1ElseIf ((bX4 And (bY_3 Or bXY_3 Or bYX_3 Or b1Y_3 Or b1XY_3 Or b1YX_3)) Or _ (bY4 And (bX_3 Or bXY_3 Or bYX_3 Or b1X_3 Or b1XY_3 Or b1YX_3)) Or _(bXY4 And (bY_3 Or bX_3 Or bYX_3 Or b1Y_3 Or b1X_3 Or b1YX_3)) Or _(bYX4 And (bY_3 Or bXY_3 Or bX_3 Or b1Y_3 Or b1XY_3 Or b1X_3)) Or _(b1X4 And (bY_3 Or bXY_3 Or bYX_3 Or b1Y_3 Or b1XY_3 Or b1YX_3)) Or _(b1Y4 And (bX_3 Or bXY_3 Or bYX_3 Or b1X_3 Or b1XY_3 Or b1YX_3)) Or _(b1XY4 And (bY_3 Or bX_3 Or bYX_3 Or b1Y_3 Or b1X_3 Or b1YX_3)) Or _(b1YX4 And (bY_3 Or bXY_3 Or bX_3 Or b1Y_3 Or b1XY_3 Or b1X_3))) ThennGrade = 3m_nType = 1ElseIf ((bX_3 And (bY_3 Or bXY_3 Or bYX_3 Or b1Y_3 Or b1XY_3 Or b1YX_3)) Or _ (bY_3 And (bX_3 Or bXY_3 Or bYX_3 Or b1X_3 Or b1XY_3 Or b1YX_3)) Or _(bXY_3 And (bY_3 Or bX_3 Or bYX_3 Or b1Y_3 Or b1X_3 Or b1YX_3)) Or _(bYX_3 And (bY_3 Or bXY_3 Or bX_3 Or b1Y_3 Or b1XY_3 Or b1X_3)) Or _(b1X_3 And (bY_3 Or bXY_3 Or bYX_3 Or b1Y_3 Or b1XY_3 Or b1YX_3)) Or _(b1Y_3 And (bX_3 Or bXY_3 Or bYX_3 Or b1X_3 Or b1XY_3 Or b1YX_3)) Or _(b1XY_3 And (bY_3 Or bX_3 Or bYX_3 Or b1Y_3 Or b1X_3 Or b1YX_3)) Or _(b1YX_3 And (bY_3 Or bXY_3 Or bX_3 Or b1Y_3 Or b1XY_3 Or b1X_3))) ThennGrade = 4m_nType = 2ElseIf ((bXY4 And (bYX_2 Or bY_2 Or bX_2)) Or _(bYX4 And (bXY_2 Or bY_2 Or bX_2)) Or _(bX4 And (bXY_2 Or bYX_2 Or bY_2)) Or _(bY4 And (bXY_2 Or bYX_2 Or bX_2))) ThennGrade = 5m_nType = 1ElseIf ((bXY4 And (bYX3 Or bY3 Or bX3)) Or _(bYX4 And (bXY3 Or bY3 Or bX3)) Or _(bX4 And (bXY3 Or bYX3 Or bY3)) Or _(bY4 And (bXY3 Or bYX3 Or bX3))) Then nGrade = 6m_nType = 1ElseIf ((bXY4 And (bYX_1 Or bY_1 Or bX_1)) Or _(bYX4 And (bXY_1 Or bY_1 Or bX_1)) Or _(bX4 And (bXY_1 Or bYX_1 Or bY_1)) Or _(bY4 And (bXY_1 Or bYX_1 Or bX_1))) Then nGrade = 7m_nType = 2ElseIf ((bXY4 And (bYX2 Or bY2 Or bX2)) Or _(bYX4 And (bXY2 Or bY2 Or bX2)) Or _(bX4 And (bXY2 Or bYX2 Or bY2)) Or _(bY4 And (bXY2 Or bYX2 Or bX2))) Then nGrade = 8m_nType = 1ElseIf (bXY4 Or bYX4 Or bX4 Or bY4) ThennGrade = 9m_nType = 1ElseIf ((bXY_3 And (bYX_2 Or bY_2 Or bX_2)) Or _(bYX_3 And (bXY_2 Or bY_2 Or bX_2)) Or _(bX_3 And (bXY_2 Or bYX_2 Or bY_2)) Or _(bY_3 And (bXY_2 Or bYX_2 Or bX_2))) Then nGrade = 10m_nType = 2ElseIf ((bXY_3 And (bYX3 Or bY3 Or bX3)) Or _(bYX_3 And (bXY3 Or bY3 Or bX3)) Or _(bX_3 And (bXY3 Or bYX3 Or bY3)) Or _(bY_3 And (bXY3 Or bYX3 Or bX3))) Then nGrade = 11m_nType = 2ElseIf ((bXY_3 And (bYX_1 Or bY_1 Or bX_1)) Or _(bYX_3 And (bXY_1 Or bY_1 Or bX_1)) Or _(bX_3 And (bXY_1 Or bYX_1 Or bY_1)) Or _(bY_3 And (bXY_1 Or bYX_1 Or bX_1))) Then nGrade = 12m_nType = 2ElseIf ((bXY_3 And (bYX2 Or bY2 Or bX2)) Or _(bYX_3 And (bXY2 Or bY2 Or bX2)) Or _(bX_3 And (bXY2 Or bYX2 Or bY2)) Or _(bY_3 And (bXY2 Or bYX2 Or bX2))) ThennGrade = 13m_nType = 2ElseIf (bXY_3 Or bYX_3 Or bX_3 Or bY_3) ThennGrade = 14m_nType = 2ElseIf (bXY_2 Or bYX_2 Or bX_2 Or bY_2) ThennGrade = 16ElseIf (bXY3 Or bYX3 Or bX3 Or bY3) ThennGrade = 17ElseIf (bXY2 Or bYX2 Or bX2 Or bY2) ThennGrade = 18ElseIf (bXY_1 Or bYX_1 Or bX_1 Or bY_1) ThennGrade = 19ElsenGrade = 20End IfIf (nGrade > 15) ThenIf (((nX - 2) >= 0) And ((nY - 2) >= 0)) ThenIf ((m_Board(nX, nY - 1) = 0 Or m_Board(nX, nY - 1) = cValue) And _(m_Board(nX + 1, nY) = 0 Or m_Board(nX + 1, nY) = cValue) And _(m_Board(nX, nY + 1) = 0 Or m_Board(nX, nY + 1) = cValue) And _(m_Board(nX - 1, nY) = 0 Or m_Board(nX - 1, nY) = cValue) And _((nX + 2 < 15 And nY - 2 >= 0 And (m_Board(nX + 2, nY - 2) = 0 Or m_Board(nX + 2, nY - 2) = cValue) And _m_Board(nX, nY - 2) = cValue And m_Board(nX + 1, nY - 1) = cValue And m_Board(nX + 2, nY) = cValue) Or _(nX + 2 < 15 And nY + 2 < 15 And (m_Board(nX + 2, nY + 2) = 0 Or m_Board(nX + 2, nY + 2) = cValue) And _m_Board(nX, nY + 2) = cV alue And m_Board(nX + 1, nY + 1) = cValue And m_Board(nX + 2, nY) = cValue) Or _(nX - 2 >= 0 And nY + 2 < 15 And (m_Board(nX - 2, nY + 2) = 0 Or m_Board(nX - 2, nY + 2) = cValue) And _m_Board(nX, nY + 2) = cValue And m_Board(nX - 1, nY + 1) = cV alue And m_Board(nX - 2, nY) = cValue) Or _(nX - 2 >= 0 And nY - 2 >= 0 And (m_Board(nX - 2, nY - 2) = 0 Or m_Board(nX - 2, nY - 2) = cValue) And _m_Board(nX, nY - 2) = cV alue And m_Board(nX - 1, nY - 1) = cValue And m_Board(nX - 2, nY) = cValue))) ThennGrade = 15End IfEnd IfEnd IfiWho = cValueJudge = nGradeEnd FunctionPrivate Sub ring()Cells(17, 3) = Cells(17, 3) + 1If m_nType = 0 ThenIf iWho = 2 ThenIf Cells(17, 3) < 16 ThenMsgBox "Congratulation!! You win by only total " & Cells(17, 3) & " stones, you are cool!"ElseMsgBox "Congratulation!! You win by total " & Cells(17, 3) & " stones, still OK!"End IfElseIf Cells(17, 3) < 16 ThenMsgBox "Sorry!! Computer win by only total " & Cells(17, 3) & " stones, you are bad player!"ElseMsgBox "Sorry!! Computer win by total " & Cells(17, 3) & " stones, you need more practices!"End IfEnd IfCells(17, 1) = ""Cells(17, 3) = 0Range(Cells(17 + 1, 1), Cells(17 + 15, 15)).Value = 0EndEnd IfEnd Sub。

联网式-中国象棋VB源代码 萨云轩 工作室

联网式-中国象棋VB源代码 萨云轩  工作室

Option ExplicitPublic bIsNet As BooleanConst FF_EMP = -1Const FF_SIDE1 = 0Const FF_SIDE2 = 1Dim local_side As IntegerDim pos_side As IntegerDim Chess_On As IntegerConst FF_US_INITALL = 0Const FF_US_INITNET = 1Const FF_US_INITLOCAL = 2Const FF_US_NET_CON = 3Const FF_US_USE_CON = 4Dim b_Server As BooleanDim b_isCon As BooleanPublic m_Set As StringDim m_BeSet As String'USER STA TEEnum FF_UA_STA TEFF_UA_INITFF_UA_WAITINGFF_UA_USEFF_UA_INV ALIDEnd EnumDim m_State As FF_UA_STA TEPrivate Sub TransSide(ByRef side As Integer) If side = FF_SIDE1 Thenside = FF_SIDE2Elseside = FF_SIDE1End IfEnd SubPrivate Sub TransState(method As Integer) main.WindowState = vbNormalSelect Case methodCase FF_US_INITALLInitalBoardm_State = FF_UA_INV ALIDc_MunNew.V isible = Falsec_MunLoad.Enabled = Truec_eState.Text = ""c_eMsg.Text = ""c_CmdSay.Enabled = Falsec_MunShow.Checked = bIsNetpos_side = FF_SIDE1Chess_On = FF_EMPc_spChessOn.V isible = Falsec_sUse.Closeb_isCon = FalseCase FF_US_INITNETfrm_net.V isible = Truemain.Width = 8835pic_noclick.Visible = Truepic_click.Visible = Falsec_sColor.FillColor = &H8000000Fc_CmdCon.Enabled = TrueCase FF_US_INITLOCALfrm_net.V isible = Falsemain.Width = 5880pic_noclick.Visible = Falsepic_click.Visible = Truec_sColor.FillColor = vbRedlocal_side = FF_SIDE1Case FF_US_NET_CONc_CmdSay.Enabled = Trueb_isCon = Truec_CmdCon.Enabled = Falsec_eState.Text = "网络连接成功" Case FF_US_USE_CONm_State = FF_UA_USEc_MunLoad.Enabled = Falsec_MunNew.V isible = Falsec_eState.Text = "开始"End SelectEnd SubPrivate Sub InitalBoard()Dim i As IntegerDim x_step, d_step As Integerx_step = 0d_step = -1For i = 0 To 8c_chess(i).Top = 0c_chess(i).Left = 2595 + x_step * d_stepc_chess(i + 16).Top = 5400c_chess(i + 16).Left = c_chess(i).LeftIf (i / 2 = Int(i / 2)) Then x_step = x_step + 600d_step = -d_stepNext iFor i = 0 To 1c_chess(i + 9).Top = 1200c_chess(i + 9).Left = 795 + i * 3600c_chess(i + 25).Top = 4200c_chess(i + 25).Left = c_chess(i + 9).LeftNext iFor i = 0 To 4c_chess(i + 11).Top = 1800c_chess(i + 11).Left = 195 + i * 1200c_chess(i + 27).Top = 3600c_chess(i + 27).Left = c_chess(i + 11).LeftNext iFor i = 0 To 31c_chess(i).V isible = TrueNext iEnd SubPrivate Function DuiJiang() As BooleanDim i, count, temp As IntegerIf Not c_chess(0).Left = c_chess(16).Left ThenDuiJiang = FalseExit FunctionEnd Iftemp = Sgn(c_chess(16).Top - c_chess(0).Top)count = 0For i = c_chess(0).Top / 600 + temp To c_chess(16).Top / 600 - temp Step temp If FindChessInPos((c_chess(0).Left - 195) / 600, i) > -1 Then count = count + 1 Next iIf count = 0 ThenDuiJiang = TrueExit FunctionEnd IfDuiJiang = FalseEnd FunctionPrivate Sub Die(ByV al chess_die As Integer)If chess_die = 0 ThenMsgBox "黑方输了", vbOKOnly, App.LegalTrademarksElseMsgBox "红方输了", vbOKOnly, App.LegalTrademarksEnd IfIf bIsNet = True ThenInitalBoardm_State = FF_UA_INITc_MunNew.V isible = Truec_MunLoad.Enabled = Truec_eState.Text = ""c_eMsg.Text = ""c_CmdSay.Enabled = Truec_MunShow.Checked = bIsNetpos_side = FF_SIDE1Chess_On = FF_EMPc_spChessOn.V isible = Falsefrm_net.V isible = Truepic_noclick.Visible = Truepic_click.Visible = Falsec_sColor.FillColor = &H8000000FElseTransState FF_US_INITALLTransState FF_US_INITLOCALEnd IfEnd SubPrivate Function GoChess(ByV al chess As Integer, ByV al x_off As Integer _ , ByV al y_off As Integer) As BooleanDim use_side As IntegerDim x_begin, y_begin As IntegerDim Distent As SingleDim i As IntegerIf chess > 15 Thenuse_side = FF_SIDE2Elseuse_side = FF_SIDE1End Ifx_begin = (c_chess(chess).Left - 195) / 600y_begin = (c_chess(chess).Top) / 600Distent = Sqr((x_off - x_begin) ^ 2 + (y_off - y_begin) ^ 2)Select Case Int((chess - use_side * 16 + 1) / 2)Case 0 'jianIf Distent > 1 Then GoTo errhandleIf x_off < 3 Or x_off > 5 Then GoTo errhandleIf GetSelf(chess, y_off) > 2 Then GoTo errhandlec_chess(chess).Left = x_off * 600 + 195If DuiJiang = True ThenMsgBox "Can Not this col", vbOKOnly, App.LegalTrademarksc_chess(chess).Left = x_begin * 600 + 195GoTo errhandleEnd IfCase 1 'shiIf Distent < 1.4 Or Distent > 1.5 Then GoTo errhandleIf x_off < 3 Or x_off > 5 Then GoTo errhandleIf GetSelf(chess, y_off) > 2 Then GoTo errhandleCase 2 'xiangIf Distent < 2.8 Or Distent > 2.9 Then GoTo errhandleIf GetSelf(chess, y_off) > 4 Then GoTo errhandleIf FindChessInPos((x_off + x_begin) / 2, (y_begin + y_off) / 2) > -1 Then GoTo errhandle Case 3 'maIf Distent < 2.2 Or Distent > 2.3 Then GoTo errhandleIf FindChessInPos(x_off - Sgn(x_off - x_begin), y_off - Sgn(y_off - y_begin)) > -1 Then GoTo errhandleCase 4 'cheIf (Not x_begin = x_off) And (Not y_begin = y_off) Then GoTo errhandleIf x_begin = x_off ThenFor i = y_begin + Sgn(y_off - y_begin) To y_off - Sgn(y_off - y_begin) Step Sgn(y_off - y_begin)If Not FindChessInPos(x_off, i) = -1 Then GoTo errhandleNext iEnd IfIf y_begin = y_off ThenFor i = x_begin + Sgn(x_off - x_begin) To x_off - Sgn(x_off - x_begin) Step Sgn(x_off - x_begin)If Not FindChessInPos(i, y_off) = -1 Then GoTo errhandleNext iEnd IfCase 5 'paoIf (Not x_begin = x_off) And (Not y_begin = y_off) Then GoTo errhandleIf x_begin = x_off ThenFor i = y_begin + Sgn(y_off - y_begin) To y_off Step Sgn(y_off - y_begin) If Not FindChessInPos(x_off, i) = -1 Then GoTo errhandleNext iEnd IfIf y_begin = y_off ThenFor i = x_begin + Sgn(x_off - x_begin) To x_off Step Sgn(x_off - x_begin) If Not FindChessInPos(i, y_off) = -1 Then GoTo errhandleNext iEnd IfCase Else 'bingIf Distent > 1 Then GoTo errhandleIf GetSelf(chess, y_off) < GetSelf(chess, y_begin) Then GoTo errhandleIf GetSelf(chess, y_off) < 5 And (Not x_off = x_begin) Then GoTo errhandle End Selectc_chess(chess).Left = x_off * 600 + 195c_chess(chess).Top = y_off * 600If bIsNet = False ThenTransSide local_sideIf c_sColor.FillColor = vbRed Thenc_sColor.FillColor = vbBlueElsec_sColor.FillColor = vbRedEnd IfElsepic_click.Visible = Not pic_click.Visiblepic_noclick.Visible = Not pic_click.VisibleEnd IfTransSide pos_sideGoChess = TrueExit Functionerrhandle:GoChess = FalseEnd FunctionPrivate Function FindChessInPos(ByV al X As Integer, ByV al Y As Integer) As Integer Dim i As IntegerFor i = 0 To 31If c_chess(i).V isible = True And c_chess(i).Top / 600 = Y And (c_chess(i).Left - 195) / 600 = X ThenFindChessInPos = iExit FunctionEnd IfNext iFindChessInPos = -1End FunctionPrivate Sub TransBoard()Dim i, x_off, y_off As IntegerFor i = 0 To 31x_off = (c_chess(i).Left - 195) / 600x_off = 8 - x_offy_off = c_chess(i).Top / 600y_off = 9 - y_offc_chess(i).Left = x_off * 600 + 195c_chess(i).Top = y_off * 600Next iEnd SubPrivate Function GetSelf(ByV al chess As Integer, ByV al Y As Integer) As IntegerDim temp_side As IntegerIf bIsNet = True Thentemp_side = Int(chess / 16)If Not local_side = temp_side ThenGetSelf = 9 - YElseGetSelf = YEnd IfElseIf chess > 15 ThenGetSelf = 9 - YElseGetSelf = YEnd IfEnd IfEnd FunctionPrivate Sub c_chess_Click(Index As Integer)If (bIsNet = True) And (Not m_State = FF_UA_USE) Then Exit SubIf Not pos_side = local_side Then Exit SubDim i As IntegerDim count As IntegerDim x_off, y_off, x_begin, y_begin As Integerx_off = (c_chess(Index).Left - 195) / 600y_off = (c_chess(Index).Top) / 600If Not Int(Index / 16) = local_side ThenChess_On = Indexc_spChessOn.Left = c_chess(Chess_On).Left - 60c_spChessOn.Top = c_chess(Chess_On).Top - 60c_spChessOn.V isible = TrueElseIf Chess_On = FF_EMP Then Exit SubIf GoChess(Chess_On, x_off, y_off) = True ThenIf bIsNet = True And m_State = FF_UA_USE Then c_sUse.SendData _"Post " + Chr(Chess_On + 65) + Chr(x_off + 48) + Chr(y_off + 48) c_chess(Index).V isible = FalseIf Index = 0 Or Index = 16 ThenDie IndexExit SubEnd IfChess_On = FF_EMPc_spChessOn.V isible = FalseElseIf Chess_On = 9 Or Chess_On = 10 Or Chess_On = 25 Or Chess_On = 25 Or Chess_On = 26 Thenx_begin = (c_chess(Chess_On).Left - 195) / 600y_begin = (c_chess(Chess_On).Top) / 600count = 0If (Not x_begin = x_off) And (Not y_begin = y_off) Then Exit SubIf x_begin = x_off ThenFor i = y_begin + Sgn(y_off - y_begin) To y_off - Sgn(y_off - y_begin) Step Sgn(y_off - y_begin)If Not FindChessInPos(x_off, i) = -1 Then count = count + 1Next iEnd IfIf y_begin = y_off ThenFor i = x_begin + Sgn(x_off - x_begin) To x_off - Sgn(x_off - x_begin) Step Sgn(x_off - x_begin)If Not FindChessInPos(i, y_off) = -1 Then count = count + 1Next iEnd IfEnd IfEnd IfIf count = 1 ThenIf bIsNet = True And m_State = FF_UA_USE Then c_sUse.SendData _ "Post " + Chr(Chess_On + 65) + Chr(x_off + 48) + Chr(y_off + 48) c_chess(Chess_On).Top = c_chess(Index).Topc_chess(Chess_On).Left = c_chess(Index).Leftc_chess(Index).V isible = FalseIf Index = 0 Or Index = 16 ThenDie IndexExit SubEnd IfChess_On = FF_EMPc_spChessOn.V isible = FalseIf bIsNet = False ThenTransSide local_sideIf c_sColor.FillColor = vbRed Thenc_sColor.FillColor = vbBlueElsec_sColor.FillColor = vbRedEnd IfElsepic_click.Visible = Not pic_click.Visiblepic_noclick.Visible = Not pic_noclick.VisibleEnd IfTransSide pos_sideEnd IfEnd IfEnd SubPrivate Sub c_cmdReset_Click()Load f_Gnetf_Gnet.Show vbModal, mainTransState FF_US_INITALLIf bIsNet = True ThenTransState FF_US_INITNETElseTransState FF_US_INITLOCALEnd IfEnd SubPrivate Sub c_MunExit_Click()Unload MeEnd SubPrivate Sub c_MunLoad_Click()On Error GoTo calcelhandlec_cdgFile.DialogTitle = "Load"c_cdgFile.ShowOpenDim i, x_off, y_off, temp As IntegerDim message As Stringmessage = "Load "Open c_cdgFile.FileName For Input As #2Input #2, local_side, pos_sidemessage = message + Chr(local_side + 65)message = message + Chr(pos_side + 65)If local_side = FF_SIDE1 Thenc_sColor.FillColor = vbRedElsec_sColor.FillColor = vbBlueEnd IfIf local_side = pos_side Thenpic_noclick.Visible = Falsepic_click.Visible = TrueElsepic_click.Visible = Falsepic_noclick.Visible = TrueEnd IfFor i = 0 To 31Input #2, temp, y_off, x_offmessage = message + Chr(temp + 65) + Chr(x_off + 48) + Chr(y_off + 48) c_chess(i).Left = x_off * 600 + 195c_chess(i).Top = y_off * 600If temp = 0 Thenc_chess(i).V isible = FalseElsec_chess(i).V isible = TrueEnd IfNext iClose #2c_MunLoad.Enabled = Falsemessage = message + " Eold"If bIsNet = True Thenc_sUse.SendData messageEnd Ifm_State = FF_UA_USEExit Subcalcelhandle:Close #2End SubPrivate Sub c_MunNew_Click()If b_isCon = False Or b_Server = False Then Exit SubMsgBox "请选单双让对方猜先", vbOKOnly, App.LegalTrademarks Load f_Gfstf_Gfst.Show vbModal, mainc_sUse.SendData "Gues " + m_Setc_MunNew.V isible = FalseEnd SubPrivate Sub c_MunSave_Click()On Error GoTo calcelhandlec_cdgFile.DialogTitle = "Save"c_cdgFile.ShowSaveDim i As IntegerOpen c_cdgFile.FileName For Output As #1Print #1, local_side, pos_sideFor i = 0 To 31If c_chess(i).V isible = True ThenPrint #1, 1, (c_chess(i).Top / 600), ((c_chess(i).Left - 195) / 600) ElsePrint #1, 0, (c_chess(i).Top / 600), ((c_chess(i).Left - 195) / 600) End IfNext iExit Subcalcelhandle:Close #1End SubPrivate Sub c_MunShow_Click()c_MunShow.Checked = Not c_MunShow.Checkedfrm_net.V isible = c_MunShow.CheckedIf frm_net.V isible = True Thenmain.Width = 8835Elsemain.Width = 5880End IfEnd SubPrivate Sub c_pboard_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If (bIsNet = True) And (Not m_State = FF_UA_USE) Then Exit SubIf Not pos_side = local_side Then Exit SubIf Chess_On = FF_EMP Then Exit SubIf X < 195 Or Y < 0 Then Exit SubIf X > 9 * 600 + 195 Or Y > 10 * 600 Then Exit SubDim x_off, y_off As Integerx_off = Int((X - 195) / 600)y_off = Int(Y / 600)If X - (x_off * 600 + 195) > 475 Or Y - y_off * 600 > 475 Then Exit SubIf GoChess(Chess_On, x_off, y_off) = False Then Exit SubIf bIsNet = True And m_State = FF_UA_USE Then c_sUse.SendData _"Post " + Chr(Chess_On + 65) + Chr(x_off + 48) + Chr(y_off + 48)Chess_On = FF_EMPc_spChessOn.V isible = FalseEnd SubPrivate Sub Form_Load()On Error GoTo errhandleTransState FF_US_INITALLIf bIsNet = True ThenTransState FF_US_INITNETc_sListen.ListenElseTransState FF_US_INITLOCALEnd IfExit Suberrhandle:MsgBox "System Wrong", vbOKOnly, App.LegalTrademarksEndEnd SubPrivate Sub c_CmdCon_Click()On Error GoTo errhandlec_sUse.LocalPort = 0c_sUse.RemotePort = 6112c_sUse.RemoteHost = c_eAddr.Textc_sUse.Connectc_CmdCon.Enabled = FalseExit Suberrhandle:MsgBox "Net wrong, Click <Connect> for a while", vbOKOnly, App.LegalTrademarksEnd SubPrivate Sub c_sListen_ConnectionRequest(ByV al requestID As Long)If b_isCon = True Or (Not c_sUse.State = 0) Then Exit Subc_sUse.LocalPort = 0c_sUse.Accept requestIDTransState FF_US_NET_CONb_Server = TrueEnd SubPrivate Sub c_sListen_Error(ByV al Number As Integer, Description As String, ByV al Scode As Long, ByV al Source As String, ByV al HelpFile As String, ByV al HelpContext As Long, CancelDisplay As Boolean)MsgBox Description, vbOKOnly, App.LegalTrademarksEndEnd SubPrivate Sub c_sUse_Close()MsgBox "连接已经关闭!!", vbOKOnly, App.LegalTrademarksTransState FF_US_INITALLTransState FF_US_INITNETc_eAddr.Text = c_sUse.RemoteHostIPEnd SubPrivate Sub c_sUse_Connect()c_sUse.SendData "Init"b_Server = FalseTransState FF_US_NET_CONm_State = FF_UA_INITEnd SubPrivate Sub c_sUse_DataArrival(ByV al bytesTotal As Long)If bIsNet = False Then Exit SubDim message As StringDim x_off, y_off, i, temp As Integerc_sUse.GetData message, vbString, bytesTotalSelect Case Left(message, 4)Case "Msag"c_eMsg.Text = Right(message, Len(message) - 5)Case "Init"If (Not m_State = FF_UA_INV ALID) Or (b_Server = False) Then _ GoTo Errorhandlec_eState.Text = c_sUse.RemoteHost + "@" + c_sUse.RemoteHostIP + "来了"m_State = FF_UA_INITc_MunNew.V isible = TrueCase "Gues"If (Not m_State = FF_UA_INIT) Or (b_Server = True) Then _GoTo Errorhandlem_BeSet = Mid(message, 6, 1)MsgBox "猜先", vbOKOnly, App.LegalTrademarksLoad f_Gfstf_Gfst.Show vbModal, mainIf Not m_Set = m_BeSet Thenc_sUse.SendData "Y our"local_side = FF_SIDE2pic_click.Visible = Falsepic_noclick.Visible = Truec_sColor.FillColor = vbBlueTransBoardElsec_sUse.SendData "Mfst"local_side = FF_SIDE1pic_noclick.Visible = Falsepic_click.Visible = Truec_sColor.FillColor = vbRedEnd IfTransState FF_US_USE_CONCase "Y our"If (Not m_State = FF_UA_INIT) Or (b_Server = False) Then _GoTo ErrorhandleTransState FF_US_USE_CONlocal_side = FF_SIDE1pic_noclick.Visible = Falsepic_click.Visible = Truec_sColor.FillColor = vbRedCase "Mfst"If (Not m_State = FF_UA_INIT) Or (b_Server = False) Then _GoTo ErrorhandleTransState FF_US_USE_CONlocal_side = FF_SIDE2pic_click.Visible = Falsepic_noclick.Visible = Truec_sColor.FillColor = vbBlueTransBoardCase "Load"If (Not m_State = FF_UA_INIT) Or (b_Server = True) Then _ GoTo Errorhandlelocal_side = Asc(Mid(message, 6, 1)) - 65TransSide local_sidepos_side = Asc(Mid(message, 7, 1)) - 65If local_side = FF_SIDE1 Thenc_sColor.FillColor = vbRedElsec_sColor.FillColor = vbBlueEnd IfIf pos_side = local_side Thenpic_noclick.Visible = Falsepic_click.Visible = TrueElsepic_click.Visible = Falsepic_noclick.Visible = TrueEnd IfDim j As Integerj = 0For i = 8 To bytesTotal - 5 Step 3temp = Asc(Mid(message, i, 1)) - 65x_off = Asc(Mid(message, i + 1, 1)) - 48y_off = Asc(Mid(message, i + 2, 1)) - 48If x_off < 0 Or x_off > 8 Or y_off < 0 Or y_off > 9 Then Exit Sub c_chess(j).Top = y_off * 600c_chess(j).Left = x_off * 600 + 195If temp = 0 Thenc_chess(j).V isible = FalseElsec_chess(j).V isible = TrueEnd Ifj = j + 1Next iTransBoardm_State = FF_UA_USECase "Post"Dim chess, chess_die, x_begin, y_begin, count As IntegerIf Not m_State = FF_UA_USE Then GoTo ErrorhandleIf pos_side = local_side Then GoTo Errorhandlechess = Asc(Mid(message, 6, 1)) - 65x_off = Asc(Mid(message, 7, 1)) - 48y_off = Asc(Mid(message, 8, 1)) - 48y_off = 9 - y_offx_off = 8 - x_offchess_die = FindChessInPos(x_off, y_off)If GoChess(chess, x_off, y_off) = False ThenIf chess = 9 Or chess = 10 Or chess = 25 Or chess = 25 Or chess = 26 ThenIf chess_die = -1 Then GoTo Errorhandlex_begin = (c_chess(chess).Left - 195) / 600y_begin = (c_chess(chess).Top) / 600count = 0If (Not x_begin = x_off) And (Not y_begin = y_off) Then GoTo ErrorhandleIf x_begin = x_off ThenFor i = y_begin + Sgn(y_off - y_begin) To y_off - Sgn(y_off - y_begin) Step Sgn(y_off - y_begin)If Not FindChessInPos(x_off, i) = -1 Then count = count + 1Next iEnd IfIf y_begin = y_off ThenFor i = x_begin + Sgn(x_off - x_begin) To x_off - Sgn(x_off - x_begin) Step Sgn(x_off - x_begin)If Not FindChessInPos(i, y_off) = -1 Then count = count + 1Next iEnd IfElseGoTo ErrorhandleEnd IfIf count = 1 Thenc_chess(chess).Top = c_chess(chess_die).Topc_chess(chess).Left = c_chess(chess_die).Leftc_chess(chess_die).V isible = FalseIf chess_die = 0 Or chess_die = 16 ThenDie chess_dieExit SubEnd IfTransSide pos_sidepic_click.Visible = Not pic_click.Visiblepic_noclick.Visible = Not pic_noclick.VisibleEnd IfElseIf chess_die = -1 Then Exit Subc_chess(chess_die).V isible = FalseIf chess_die = 0 Or chess_die = 16 ThenDie chess_dieExit SubEnd IfEnd IfCase ElseGoTo ErrorhandleEnd SelectExit SubErrorhandle:If Not message = "Invalid Command" Thenc_sUse.SendData "Invalid Command"Elsec_eState.Text = "错误的命令或操作"End IfEnd SubPrivate Sub c_sUse_Error(ByV al Number As Integer, Description As String, ByV al Scode As Long, ByV al Source As String, ByV al HelpFile As String, ByV al HelpContext As Long, CancelDisplay As Boolean)MsgBox Description, vbOKOnly, App.LegalTrademarksTransState FF_US_INITALLTransState FF_US_INITNETEnd Sub'中国象棋Option ExplicitPrivate Sub Form_Load()opt_Net.V alue = Falseopt_Local.V alue = TrueEnd SubPrivate Sub m_CmdNetOk_Click() main.bIsNet = opt_Net.V alue Unload f_GnetLoad mainmain.ShowEnd Sub'中国象棋-VB开发Option ExplicitPrivate Sub Form_Load()opt_d.V alue = TrueEnd SubPrivate Sub m_cmdGfstOk_Click() If opt_d.V alue = True Then main.m_Set = "D"Elsemain.m_Set = "S"End IfUnload f_GfstEnd Sub。

商品归类代码说明第九十五章

商品归类代码说明第九十五章

商品归类代码说明第九十五章商品归类代码说明(第九十五章)商品名称编码附加编码附加序号说明儿童三轮车 95010000 - 001 -儿童踏板车 95010000 - 002 -儿童踏板汽车 95010000 - 003 -玩偶车 95010000 - 004 -游戏用赛车 95010000 - 005 -布公仔 95021000 - 001 指玩偶塑胶公仔 95021000 - 002 指玩偶玩偶 95021000 - 003 -公仔棉衫裤 95029100 - 001 指玩偶用公仔衫 95029100 - 002 指玩偶公仔衫裁片 95029100 - 003 -毛冷公仔衫 95029100 - 004 -毛冷公仔衫 95029100 - 005 指玩偶娃娃衣服裁片 95029100 - 006 -玩偶服装 95029100 - 007 -玩偶帽 95029100 - 008 -玩偶衫裁片 95029100 - 009 -玩偶鞋 95029100 - 010 -玩偶鞋仔 95029100 - 011 -玩偶靴 95029100 - 012 -鼻子 95029900 - 001 指玩偶瓷器脚 95029900 - 002 指玩偶瓷器手 95029900 - 003 指玩偶瓷器头 95029900 - 004 指玩偶各式头发 95029900 - 005 指玩偶公仔发线 95029900 - 006 指玩偶公仔活动眼 95029900 - 007 指玩偶公仔脚 95029900 - 008 指玩偶公仔手 95029900 - 009 指玩偶公仔塑胶鼻 95029900 - 010 指玩偶公仔塑胶眼 95029900 - 011 指玩偶公仔头 95029900 - 012 指玩偶公仔头发 95029900 - 013 指玩偶公仔眼 95029900 - 014 指玩偶公仔眼片 95029900 - 015 指玩偶公仔眼珠 95029900 - 016 指玩偶关节 95029900 - 017 指玩偶假发 95029900 - 018 指玩偶假发丝 95029900 - 019 指玩偶胶鼻子 95029900 - 020 指玩偶胶眼睛 95029900 - 021 指玩偶胶眼珠 95029900 - 022 指玩偶开关制 95029900 - 023 玩偶开关制尼龙发丝 95029900 - 024 指玩偶尼龙发线 95029900 - 025 指玩偶尼龙假发 95029900 - 026 指玩偶尼龙头发 95029900 - 027 指玩偶饰物 95029900 - 028 指玩偶娃娃架 95029900 - 029 -娃娃站台 95029900 - 030 -玩偶发音装置 95029900 - 031 玩偶零件线路板 95029900 - 032 玩偶零件鞋仔 95029900 - 033 玩偶鞋眼睛活动装置 95029900 - 034 指玩偶宝马模型 95032000 - 001 -飞机模型 95032000 - 002 -汽车模型 95032000 - 003 -建筑玩具 95033000 - 001 -毛绒动物玩具 95034100 - 001 -毛绒玩具 95034100 - 002 指玩具动物兔毛老鼠玩具 95034100 - 003 填充玩具塑胶动物玩具 95034900 - 001 -塑胶玩具 95034900 - 002 指玩具动物玩具钢琴 95035000 - 001 -玩具鼓 95035000 - 002 -玩具口琴 95035000 - 003 -玩具喇叭 95035000 - 004 -玩具木琴 95035000 - 005 -玩具手风琴 95035000 - 006 -玩具音乐盒 95035000 - 007 -智力玩具 95036000 - 001 -玩具电动波子机 95037000 - 001 -玩具电动车 95038000 - 001 -玩具缝纫机 95038000 - 002 -玩具遥控车 95038000 - 003 -电子鞭炮 95039000 - 001 -风筝 95039000 - 002 -跳绳 95039000 - 003 -铁球 95039000 - 004 -玩具弹子 95039000 - 005 -玩具计算器 95039000 - 006 -玩具教具 95039000 - 007 -玩具气球 95039000 - 008 -玩具钱箱 95039000 - 009 -玩具手枪 95039000 - 010 -玩具武器 95039000 - 011 -玩具戏院 95039000 - 012 -玩具蒸汽机 95039000 - 013 -玩具钟表 95039000 - 014 -玩偶盒 95039000 - 015 -婴儿摇鼓 95039000 - 016 -电子游戏机 95041000 - 001 与电视机配套使用游戏机 95041000 - 002 与电视机配套使用击球杆 95042000 - 001 -击球架 95042000 - 002 -记分牌 95042000 - 003 -球 95042000 - 004 -台球粉 95042000 - 005 -台球桌 95042000 - 006 -桌球 95042000 - 007 -电子游戏机 95043010 - 001 投币式游戏机投币式电子游戏机 95043010 - 002 -游戏机 95043010 - 003 投币式电子游戏机游戏机底盖 95043010 - 004 投币式电子游戏机零件游戏机后盖 95043010 - 005 投币式电子游戏机零件游戏机前盖 95043010 - 006 投币式电子游戏机零件主机解读器 95043010 - 007 投币式电子游戏机零件主印制板 95043010 - 008 投币式电子游戏机零件扑克 95044000 - 001 -扑克牌 95044000 - 002 -桥牌 95044000 - 003 -小型便携式游戏机 95049010 - 001 -保龄球自动分瓶机 95049021 - 001 -保龄球自动分瓶系统 95049021 - 002 -保龄球 95049022 - 001 -保龄球瓶 95049023 - 001 -保龄球道 95049029 - 001 -保龄球自动计分台 95049029 - 002 - 保龄球自动球道设备 95049029 - 003 - 国际象棋 95049030 - 001 -棋盘 95049030 - 002 -棋子 95049030 - 003 -跳棋 95049030 - 004 -象棋 95049030 - 005 -中国象棋 95049030 - 006 -麻将 95049040 - 001 -骰子 95049040 - 002 麻将用弹球机 95049090 - 001 -投镖 95049090 - 002 -投镖板 95049090 - 003 -游戏用计数器 95049090 - 004 -纸牌花色显示器 95049090 - 005 -。

Java语言课程设计中国象棋打谱系统

Java语言课程设计中国象棋打谱系统

目录1.绪论 (2)1.1引言 (2)1.2主要设计内容 (3)2.开发工具简介 (3)2.1 java语言概述 (3)2.2 java语言的特点 (4)2.3 关于ECLIPSE (5)3.程序设计需求分析 (7)3.1任务概述 (7)3.2综合要求 (7)3.3 设计基本要求 (7)4.程序的总体设计 (8)4.1线程的设计 (8)4.2线程的生命周期 (9)5.程序的详细设计 (11)5.1程序流程图 (11)5.2数据字典 (12)5.3运行结果及界面 (16)6.实验总结 (18)参考文献 (18)附录(部分源代码) (19)1.绪论1.1引言象棋水平的发展是需要靠信息技术来推动的,国际象棋有两个很好的范例,一个是象棋棋谱编辑和对弈程序的公共平台——WinBoard平台,另一个是商业的国际象棋数据库和对弈软件——ChessBase,他们为国际象棋爱好者和研究者提供了极大的便利。

国际象棋软件有着成功的商业运作,已发展成一种产业。

然而,电脑在中国象棋上的运用还刚刚起步,尽管国内涌现出一大批中国象棋的专业网站和专业软件,但是由于缺乏必要的基础工作,电脑技术在中国象棋上的应用优势还无法体现出来。

在设计中国象棋软件过程中,国际象棋软件有很多值得借鉴的成功经验和优秀的思想。

例如 B. Moreland,微软(Microsoft)的程序设计师,业余从事国际象棋引擎Ferret的开发,他的一系列关于国际象棋程序设计的文章非常值得其他棋类程序设计人员借鉴。

然而,中国象棋与国际象棋存在着很大的差异,因此国际象棋的某些成熟技术,无法直接应用于中国象棋,需要对其加以改进和创新。

1.2主要设计内容本课题采用Java语言编写这个中国象棋对弈系统程序。

主要工作内容:搜集相关资料,准备参考资料,学习掌握开发方法、开发工具,需求分析,确定游戏程序实施方案,根据要求设计具体的流程图,编写程序,修改、完善程序,系统调试、测试,优化处理。

fc秘籍

fc秘籍

30 宇宙巡航舰2
2M
金手指:
0056:63 (飞机数量)
04fc:01-06 (胶囊数量)
0501:05 (无限防护罩)
31 太空战斗机
0.50M
模拟的某些贴图时有些花,但不影响游戏.
金手指:
00ba:21 (隐身)
32 红巾特工队 (中)
0.19M
金手指:
0068:0a (飞机数量)
0492:0a (宝次数)
6570:05 (无敌变身)
28 荒野大骠客
1M
金手指:
0077: 03 (马)
0041:00-05 (选关)
29 沙罗漫蛇 (J)
1M
金手指:
0034:63 (飞机数量)
0068:01-06 (胶囊数量)
050c:13 (无敌)
40 冒险岛
0.50M
金手指:
003f:0a (人数)
006d:01,02 (武器)
0075:01 (无敌)
41 西游记
1M
金手指:
010c:05 (如意棒)
0113:01 (不死)
0117:00-03 (宝种类改变)
0118:63 (宝数量)
31 太空战斗机 32 红巾特工队 (中) 33 魂斗罗 (U) 34 魂斗罗2 (U) 35 古巴英雄 (中) 36 赤之要塞 (黑客版)
37 勇士们
24 B计划
0.31M
金手指:
00cf:00-0d (子弹) 0f (?子弹)
25 兵蜂
0.38M
金手指:
0080:63 (人数)

100个数字记忆代码编码集

100个数字记忆代码编码集

100个数字记忆代码编码集想要锻炼自己的记忆力,首先从100位记忆代码开始,怎么记忆100个数字呢?下面店铺给大家分享100位的记忆代码,希望大家喜欢。

如何快速记忆最基本的100个数字编码如果你愿意,可以这样尝试:1.了解每一个编码的来源。

数字编码的来源一般有三种:形象、谐音、熟语。

看每一个编码是属于那种;2.从1-100读一两次数字和编码,读10~99的数字时不要把“十”字念出来,如21不应该念”ershiyi”,而是念”eryi”.这样就能较容易从21想到“鳄鱼”,省“十”念法是理解和记忆谐音编码的关键;3.记忆两遍1~100个数字编码;4.在一张纸上写1~100个数字(或打印),然后根据数字来回忆对应的编码。

如果回忆出来,在数字下打勾;5.把没有打勾的数字(也就是还记不住的)找出来,对其加强记忆一遍;6.把没有打勾的数字(也就是还记不住的)写出来,回忆其对应的编码,回忆起来打勾;7.重复5-6步直到最多剩5个编码没有记住;8.很难记住的这几个编码要么换掉,要么采用邻位串联法:比如最后剩22(双胞胎)33(星星)48(西瓜)这三个数字的编码没有记住。

那么我们可以用21(鳄鱼)跟22(双胞胎)联结,“鳄鱼咬住双胞胎”,从而借助21来记住22的编码:双胞胎。

其余类推(用32记33,用47记48)9.重复1~8步几次,一到两个小时可以把100个数字编码倒背如流了。

其中有谐音也有联想。

比如63铁链(就是借用电影庐山恋)27塔(郑州二七广场的二七塔)23就是迈克尔。

乔丹的23号球衣等等,28发夹就是由二八佳人引申而来。

53就是武松,武松打虎。

75由闻鸡起舞而来。

其他大家有不清楚的地方,以后慢慢解释。

100位记忆代码:00单车01鲮鱼02铃儿03冷杉04零食(话梅或爆米花)05莲藕06凝露(露珠)07冷气(空调)08篱笆09菱角(或秃鹫)1铅笔2鸭子3弹簧4椅子5秤钩6哨子7镰刀8沙漏(或葫芦或麻花)9平底锅(或球拍)10保龄球11球门(或筷子)12鸡蛋13女巫14钥匙15月饼16玫瑰花17雨伞18投票箱19麦克风20香烟21鳄鱼22请帖23背心24时钟25二胡26猴子27塔28发夹29剪刀30吉普31蛋糕32象棋33蜗牛34烟斗35珊瑚36跑鞋37膏药38口红39滑雪板40石林41蓑衣42戒指43寺僧44石狮45竹简46石榴47磁铁48书包(或石碑)49灯笼50(武林)杂志51齿轮52扑克53老虎54手枪55火车56颜料(或山本五十六)57导弹58电脑59手铐60榴莲61滑梯62尖刀63铁链64牛屎(或螺丝,律师)65巧克力66骰子67油漆68牛扒(或萝卜牛排)69辣椒(或碌碡)70麒麟71猕猴桃(又称奇异果,或UFO)72企鹅(或孙悟空)73狼狗(或凤凰)74奶酪cheese(或骑士,牛仔)75公鸡(或杀虫剂)76篮球(飞机)77拐杖(或芦桥)78气泵79气球80银行(或钞票)81坦克(或军旗)82电话机(或白天鹅)83登山包(或帐篷)84巴士(或博士)85金刚86菠萝(或芭乐)87钳子(或白棋)88波霸89芭蕉90蛟龙(或九龙壁,或果冻)91铡刀92酒窝93救星(毛主席)94果汁(juice)95皇冠(或酒壶)96竹篓(或酒楼)97香港(或酒旗)98酒杯(或酒吧)99乌龟100蜈蚣(或寿星)数字记忆好方法:数字编码数字编码1. 笔2. 鸭子3. 伞4. 帆船红旗5. 手套钩子6.勺子7. 镰刀8. 手铐9. 酒 10. 台球衣领11. 筷子 12.闹钟婴儿 13. 石山雨伞 14.钥匙 15.月亮鹦鹉16.石榴 17.仪器 18.尾巴哑巴 19.药酒 20.鸭蛋耳环21. 鳄鱼阿姨 22.鸳鸯 23.梁山 24.粮食 25.二胡26.二流子 27.耳机 28.恶霸 29.二舅阿胶 30.山洞31. 鲨鱼山药 32.扇儿 33.耳朵蝴蝶 34.山狮山寺 35.珊瑚香烟36.山路 37.山鸡山西 38.妇女节 39.胃泰散酒 40.司令41. 司仪 42.柿儿死鹅 43.水仙 44.圣诞树逝世 45.师傅食物46.丝路四楼 47.司机 48.丝瓜石板 49.****** 50.武林盟主51. 工人 52.窝儿木耳 53.巫山 54.武士青年 55.火车56.无路蜗牛 57.武器 58.木瓜舞吧 59.无酒棺材 60.柳树林61. 儿童节 62.炉儿驴耳 63.庐山 64.螺丝 65.锣鼓路虎66.吊环大顺 67.绿旗漏气 68.喇叭路霸 69.鹿角遛狗 70.麒麟71. 奇异果起义 72.企鹅妻儿 73.岐山 74.骑士 75.舞女欺侮76.气流 77.鹊桥七喜 78.骑马 79.气球 80.百灵白领81. 解放军 82.白鹅靶儿 83.爬山 84.巴士 85.白虎86.八路军 87.白旗 88.爸爸 89.芭蕉 90.酒桶精灵91. 球衣 92.球儿 93.旧伞救生圈 94.教师调酒师95.酒壶 96.酒楼 97.香港 98.酒吧 99.蝌蚪舅舅 00.眼镜01. 北京 02.上海 03.灵山 04.零食 05.动物06.冻肉 07.灵气 08.奥运会 09.灵柩 000.铃铛数字记忆编码集数字记忆1~1001-衣树2-耳3-山4-帆船寺的士狮5-屋子舞手掌6-柳7-拐杖妻棋子8-葫芦爸八仙9-酒10-石石头十字架11-筷子湿衣食蚁兽12-婴儿湿耳食饵13-医生石山13太保14-钥匙石狮失事15-鹦鹉食物16-石榴(裙)17-石器仪器18-石坝尾巴19-golf食酒石臼20-饵食耳环21-儿衣阿姨鳄鱼22-俩儿恶尼鸳鸯23-两扇和尚24-闹钟耳屎25-二胡26-二流河流溜冰鞋27-耳机恶妻28-耳疤恶霸29-二舅喝酒恶狗30-森林山林桑实果子31-山药鲨鱼32-嫦娥三儿闪亮33-登山山川34-山寺绅士35-珊瑚36-山路三鹿37-山鸡38-伞把沙发39-山鸠散酒山猴40-司令柿子41-丝衣司仪死鱼42-刺耳警察43-四川瓷砖雪山44-逝世纸扇45-师傅失火46-思路饲料47-司机48-丝帕苏打饼干扫把49-嗜酒死狗50-舞室 50元51-武衣劳动节狐狸52-武二pizza木耳53-午餐巫山54-武士刀斧子55-污物56-乌牛轱辘57-武器手机58-壶把王八苦瓜59-壶酒武警呼叫器五角星60-绿林(好汉)榴莲61-轮椅绿叶62-驴耳驴儿63-庐山硫酸64-螺丝律师天安门65-尿壶绿屋蜡烛66-六六(粉)溜溜球67-绿漆油漆流星68-油粑喇叭69-鹿角绿酒琉球70-麒麟71-洗衣奇异果72-切耳企鹅73-旗杆74-骑士75-积木骑虎76-汽油溪流77-奇袭机器巧克力78-西瓜旗袍青蛙奇葩79-汽酒气球80-扒岭巴黎百灵白领81-粑叶白蚁白衣天使82-拔亮拔河83-巴山爬山84-百事可乐博士宝石巴士85-芭(蕾)舞宝物蝴蝶86-八路白鹭芭蕾87-拔旗白旗88-白板爸爸宝贝89-芭蕉把酒90-酒令蛟龙91-旧衣92-揪耳93-旧衫袈裟金山旧伤94-教师救死救世主95-酒壶至尊96-酒楼97-酒气救济院脚气98-酒吧99-舅舅乘法表100-衣摆一百元另附:中国记忆力训练网 110个数字编码表数字编码备选数字编码备选数字编码备选1 鱼2 鹅3 伞山4 蛇5 虎6 牛鹿7 鸡 8 马 9 酒球10 棒球 11 筷子 12 婴儿13 医生 14 钥匙 15 鹦鹉尼姑16 杨柳衣钮 17 荔枝玉玺 18 篱笆19 泥鳅月球 20 耳环 21 鳄鱼22 鸳鸯 23 和尚 24 盒子25 二胡 26 河流 27 耳机28 荷花河马、恶霸 29 阿胶鹅脚 30 森林山洞31 鲨鱼 32 仙鹤 33 仙丹34 绅士松鼠、松树 35 珊瑚 36 香炉山路、山鹿37 相机山鸡 38 沙发 39 香蕉40 司令 41 雪梨睡衣 42 死鹅雪耳43 雪山水仙 44 狮子石狮、柿子 45 水母水壶、松鼠46 石榴 47 司机树枝 48 雪花丝瓜、石板49 雪球水饺 50 五环 51 狐狸52 孤儿木耳、猪耳 53 牡丹乌纱 54 护士巫师55 木屋古墓 56 蜗牛 57 母鸡乌鸡、火机58 苦瓜木瓜、尾巴 59 五角星 60 榴莲61 轮椅老鹰、鲈鱼 62 驴儿牛耳 63 留声机64 老鼠螺丝、律师 65 锣鼓 66 绿豆67 流星绿旗 68 喇叭萝卜 69 鹿角牛角70 麒麟冰淇淋 71 蜥蜴金鱼 72 企鹅73 鸡蛋 74 鸡翅骑士、橙子 75 蜘蛛积木76 犀牛 77 七喜猩猩 78 西瓜青蛙79 气球 80 百灵鸟花环 81 蚂蚁白蚁82 白鸽百合花 83 花生 84 巴士85 白兔白虎、蝙蝠 86 菠萝八路军 87 白纸白棋、麻雀88 斑马白马、白板 89 芭蕉斑鸠 90 精灵91 球衣 92 球儿 93 救生圈94 教师 95 救护车酒壶 96 酒楼97 酒席 98 酒吧 99 胶卷00 望远镜 0 铃铛 01 树剑02 鸭子 03 耳朵弹簧 04 红旗05 钩子手套 06 勺子蝌蚪、烟斗 07 拐杖镰刀08 葫芦 09 球拍(备注:00-09、10、11、22是象形编码;20、50是混合编码;其它是谐音编码。

国际象棋棋谱记录规则

国际象棋棋谱记录规则

国际象棋棋谱记录规则
1.棋盘和每个格子的代码
以白棋为标准,棋盘上的8条竖线(列file)从左到右用a、b、c、d、e、f、g、h八个英文字母表示,棋盘的8条横线(行rank)由下而上由阿拉伯数字1、2、3、4、5、6、7、8表示,这样,棋盘上的每一个格子都是横线和竖线的交叉,交叉点上的英文字母和数字合起来就是这个格子的代码。

4.代码、符号和走子
有了上面的代码、符号,我们就可以记录我们的走子过程了。

例如:白方e2格子上的兵要走到e4格子上,就记录为
1.e4;如果黑方应以e7格子上的兵到e5格子上,就记录为1...e5(点三个点意思是下面是黑棋走的,如果与白棋连在一起,就不用点了);如果马吃e5上的兵,就记录为Nxe5(吃其他子也是这样记录);如果是象吃掉f7格子上的兵还带将军,就写成Bxf7+;如果马跳到d5格子上把对方将死了,就写成Nd5#;棋局结束了,白棋赢了,就空一格,写上1-0。

还有一些特例:如在高水平的比赛少见、但小朋友下棋的时候经常出现的升变,如白方的b线上的兵攻到了对方的底线,就可以升变成后、车、马、象(当然一般大家都会升变成后),如果真要升变成后,那么就要写成b=Q;f6格子上的马和b8上的马都可以走到d7格子上,如果你走的是b8格子上的马,就要写成Nbd7;如果你的两个车在一条竖线上,一个在e1上、一个在e7上,都可以走到e3上,如果走的e1上的车,就要写成R1e3。

总之,通过这些代码、符号我们可以清晰准确地记录下来我们走子的整个过程,便于自己复盘分析,别人也看的懂。

c++做的象棋源代码

c++做的象棋源代码
int m_nR; // 棋子半径
int m_nType; // 棋子类型
public:
CStone (){}
CStone (BOOL red, int col, int row, LPCSTR name, int type, CPlate &plate);
void ShowStone(CDC *pDC);
DrawConer(pDC, 6, 0, 1);
DrawConer(pDC, 6, 2, 0);
DrawConer(pDC, 6, 4, 0);
DrawConer(pDC, 6, 6, 0);
DrawConer(pDC, 6, 8, 2);
}
// 绘制兵, 炮位标志
void CPlate::DrawConer(CDC *pDC, int row, int col, int type)
// 二○○○年七月
// 让我们继续看我的程序。
//这是课本上的例子。
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
//可供两人对弈的中国象棋程序
#include <afxwin.h>
// 棋盘类
class CPlate
{
int m_ndx; // 棋盘格宽
{
CPen penRed1(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen = pDC->SelectObject(&penRed1);
if(type == 0 || type == 1)
{
pDC->MoveTo(m_nLeft+col*m_ndx+ 3, m_nTop+row*m_ndy-10);

中国象棋源代码C#

中国象棋源代码C#
using using using using using using using using using using using
System; System.Collections.Generic; ponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms; System.IO; System.Media; System.Diagnostics;
for (int row = 1; row <= 10; row++) { g.DrawString(row.ToString(), font2, fontBrush, new Point((int)(_leftTop.X + _columnWidth * 8.6), (int)(_leftTop.Y _rowHeight * 0.4 + _rowHeight * (row - 1)))); } //书写列数字编号 string[] colNumber = new string[10] { "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" }; Font font3 = new Font("黑体", (float)(_rowHeight * 0.5), FontStyle.Regular, GraphicsUnit.Pixel); for (int col = 1; col <= 9; col++) { g.DrawString(colNumber[col], font3, fontBrush, new Point((int)(_leftTop.X - 0.25 * _columnWidth + _columnWidth * (col 1)), (int)(_leftTop.Y + 9.6 * _rowHeight))); } //书写“甲方”“乙方” g.DrawString("甲方", font3, fontBrush, new Point(_leftTop.X + 8 * _columnWidth + 100, (int)(_leftTop.Y + 2.5 * _rowHeight))); g.DrawString("乙方", font3, fontBrush, new Point(_leftTop.X + 8 * _columnWidth + 100, (int)(_leftTop.Y + 6.5 * _rowHeight))); //绘制棋盘第三行焦点的细线条 DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 2), true, true, true, true); DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 2), true, true, true, true); //绘制第四行焦点的线条 DrawCrossLine(g, new Point(_leftTop.X, _leftTop.Y + * 3), false, true, false, true); DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 3), true, true, true, true); DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 3), true, true, true, true); DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 3), true, true, true, true); DrawCrossLine(g, new Point(_leftTop.X + _columnWidth + _rowHeight * 3), true, false, true, false); //绘制第七行焦点的线条 DrawCrossLine(g, new Point(_leftTop.X, _leftTop.Y +

中国象棋游戏代码

中国象棋游戏代码
printf("\n轮到红子动!\n");
else
printf("\n轮到黑子动!\n");
for (;;){if (q == 1)
printf("\n攻(红)方:
车(a)马(b)\n");
else
printf("\n黑(守)方:
将(E)\n");
lm1:
printf("请选择棋子代号:
");
scanf("%c", &x);
&& y != 'E'){printf("未将军\n");
goto lm1;}goto la1;}}
else {if (j1 == j - 2){if (*(*(str2 + j - 1) + i) != '0'){printf("'马'撇腿!\n重新输入下的位置:
");
goto label1;}else {if (((i1 != ii + 1 || i1 != ii - 1)
goto lm1;}goto la1;}}
else {printf("'马'应走'日'\n重新输入下的位置:
");
goto label1;}}
else {printf("'马'应走'日'\n重新输入下的位置:
");
goto label1;}}}if (x == 'E'){ii = i1;
jj = j1;
goto lm1;}}

局域网的象棋对战

局域网的象棋对战

说明本系统是一款基于Eclipse平台开发的局域网象棋对战游戏,采用Java GUI技术绘制界面,面向连接的Socket实现局域网联机,多线程同步用户信息数据。

系统分为服务器端和客户端,服务器端起到处理用户联网信息并转发数据的作用,客户端主要实现象棋对弈。

该象棋游戏界面友好,操作方便,能满足广大象棋爱好者的日常对弈需求。

目录摘要 (I)Abstract (II)1引言 (1)1.1课题背景 (1)1.2中国象棋发展现状 (1)2 开发环境与相关技术 (1)2.1 Java语言 (1)2.2 开发工具 (2)2.3 技术 (3)2.3.1 面向对象设计 (3)2.3.2 Java GUI技术 (3)2.3.3 JAVA多线程技术 (5)2.3.4 点对点通信 (6)2.3.5 TCP/IP协议 (7)3需求分析 (8)3.1 任务概述 (8)3.2 需求分析 (8)3.2.1 联机操作功能 (8)3.2.2 象棋对弈功能 (8)4总体设计 (9)4.1 系统结构图 (9)4.2 类框架设计 (9)4.2.1 服务器端 (9)4.2.2 客户端 (10)4.3 需要解决的问题 (11)5系统实现 (13)5.1 棋盘设计 (13)5.2 规则制定 (16)5.2.1 规则说明 (16)5.2.2 规则算法 (17)6运行测试 (23)6.1 服务端 (23)6.2 客户端 (24)7 总结 (27)致谢 (27)参考文献 (27)基于局域网的中国象棋游戏摘要:中国象棋具有悠久的历史。

战国时期,已经有了关于象棋的正式记载,新中国建立之后,象棋进入了一个崭新的发展阶段。

随着信息技术的发展,人民生活水平的不断提高。

联网游戏作为一种娱乐手段,正以其独特的魅力吸引着越来越多的玩家。

为了满足广大象棋爱好者也可以享受到网络所带来的便利,本设计在当前局域网条件下实现了中国象棋的网络对战。

鉴于局域网的特点和游戏本身的要求,本设计采用C/S架构来实现相互之间的通信。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

中国象棋(web版源代码)程序:using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;namespace WebApplication1{public partial class WebForm1 : System.Web.UI.Page{int tru = 20;int fals = 40;public ImageButton[,] _Image=new ImageButton[11,10];//将上一次点击点的坐标保存到数据库中的lastx和lastypublic void SaveToLast(){if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 20){int x, y, lastx, lasty;x = Getpointx();y = Getpointy();lastx = x;lasty = y;Updatalastx(lastx);Updatalasty(lasty);}if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 20){int x, y, lastx, lasty;x = Getpointx();y = Getpointy();lastx = x;lasty = y;Updatalastx(lastx);Updatalasty(lasty);}}//将棋盘上所有棋子图片显示到棋盘上private void _Drawqizi(){//_Init();int i,j,k;if (_GetUserState("red") != 0 && _GetUserState("black") != 0){if (Session["user"].ToString() == "red"){for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){k = _GetDataQipan(i, j);_Image[i, j].ImageUrl = _GetImageAdd(k);}}if (Session["user"].ToString() == "black"){for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){k = _GetDataQipan(i, j);_Image[11 - i, 10 - j].ImageUrl =_GetImageAdd(k);}}}//初始化:对_Image[,]赋值,对ImageButton进行编号private void _Init(){_Image[1, 1] = ImageButton1; _Image[1, 2] = ImageButton2; _Image[1, 3] = ImageButton3; _Image[1, 4] = ImageButton4; _Image[1, 5] = ImageButton5; _Image[1, 6] = ImageButton6; _Image[1, 7] = ImageButton7; _Image[1, 8] = ImageButton8; _Image[1, 9] = ImageButton9;_Image[2, 1] = ImageButton11; _Image[2, 2] = ImageButton12; _Image[2, 3] = ImageButton13; _Image[2, 4] = ImageButton14; _Image[2, 5] = ImageButton15; _Image[2, 6] = ImageButton16; _Image[2, 7] = ImageButton17; _Image[2, 8] = ImageButton18; _Image[2, 9] = ImageButton19;_Image[3, 1] = ImageButton21; _Image[3, 2] = ImageButton22; _Image[3, 3] = ImageButton23; _Image[3, 4] = ImageButton24; _Image[3, 5] = ImageButton25; _Image[3, 6] = ImageButton26; _Image[3, 7] = ImageButton27; _Image[3, 8] = ImageButton28; _Image[3, 9] = ImageButton29;_Image[4, 1] = ImageButton31; _Image[4, 2] = ImageButton32; _Image[4, 3] = ImageButton33; _Image[4, 4] = ImageButton34; _Image[4, 5] = ImageButton35; _Image[4, 6] = ImageButton36; _Image[4, 7] = ImageButton37; _Image[4, 8] = ImageButton38; _Image[4, 9] = ImageButton39;_Image[5, 1] = ImageButton41; _Image[5, 2] = ImageButton42; _Image[5, 3] = ImageButton43; _Image[5, 4] = ImageButton44; _Image[5, 5] = ImageButton45; _Image[5, 6] = ImageButton46; _Image[5, 7] = ImageButton47; _Image[5, 8] = ImageButton48; _Image[5, 9] = ImageButton49;_Image[6, 1] = ImageButton51; _Image[6, 2] = ImageButton52; _Image[6, 3] = ImageButton53; _Image[6, 4] = ImageButton54; _Image[6, 5] = ImageButton55; _Image[6, 6] = ImageButton56; _Image[6, 7] = ImageButton57; _Image[6, 8] = ImageButton58; _Image[6, 9] = ImageButton59;_Image[7, 1] = ImageButton61; _Image[7, 2] = ImageButton62; _Image[7, 3] = ImageButton63; _Image[7, 4] = ImageButton64; _Image[7, 5] = ImageButton65; _Image[7, 6] = ImageButton66; _Image[7, 7] = ImageButton67; _Image[7, 8] = ImageButton68; _Image[7, 9] = ImageButton69;_Image[8, 1] = ImageButton71; _Image[8, 2] = ImageButton72; _Image[8, 3] = ImageButton73; _Image[8, 4] = ImageButton74; _Image[8, 5] = ImageButton75; _Image[8, 6] = ImageButton76; _Image[8, 7] = ImageButton77; _Image[8, 8] = ImageButton78; _Image[8, 9] = ImageButton79;_Image[9, 1] = ImageButton81; _Image[9, 2] = ImageButton82; _Image[9, 3] = ImageButton83; _Image[9, 4] = ImageButton84; _Image[9, 5] = ImageButton85; _Image[9, 6] = ImageButton86; _Image[9, 7] = ImageButton87; _Image[9, 8] = ImageButton88; _Image[9, 9] = ImageButton89;_Image[10, 1] = ImageButton91; _Image[10, 2] = ImageButton92; _Image[10, 3] = ImageButton93; _Image[10, 4] = ImageButton94; _Image[10, 5] = ImageButton95; _Image[10, 6] = ImageButton96; _Image[10, 7] = ImageButton97; _Image[10, 8] = ImageButton98; _Image[10, 9] = ImageButton99;int i, j;for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){_Image[i, j].ImageUrl = "~/image/back.gif";}}//初始化棋盘,将两方棋子放好位private void _InitQizi(){int i = 0, j = 0, k = 0;int[] initqipandata = new int[37];for (i = 1; i <= 10; i++)for (j = 1; j <= 9; j++){_UpdataQipan(i, j, k);}for (i = 0; i <= 36; i++)initqipandata[i] = i;_UpdataQipan(1, 1, initqipandata[8]); _UpdataQipan(1, 2, initqipandata[6]); _UpdataQipan(1, 3, initqipandata[4]); _UpdataQipan(1, 4, initqipandata[2]); _UpdataQipan(1, 5, initqipandata[1]); _UpdataQipan(1,6, initqipandata[3]); _UpdataQipan(1, 7, initqipandata[5]); _UpdataQipan(1, 8, initqipandata[7]); _UpdataQipan(1, 9, initqipandata[9]); _UpdataQipan(3, 2, initqipandata[10]); _UpdataQipan(3, 8, initqipandata[11]); _UpdataQipan(4, 1, initqipandata[12]); _UpdataQipan(4, 3, initqipandata[13]);_UpdataQipan(4, 5, initqipandata[14]); _UpdataQipan(4, 7,initqipandata[15]); _UpdataQipan(4, 9, initqipandata[16]);_UpdataQipan(10, 1, initqipandata[28]); _UpdataQipan(10, 2, initqipandata[26]); _UpdataQipan(10, 3, initqipandata[24]);_UpdataQipan(10, 4, initqipandata[22]); _UpdataQipan(10, 5,initqipandata[21]); _UpdataQipan(10, 6, initqipandata[23]);_UpdataQipan(10, 7, initqipandata[25]); _UpdataQipan(10, 8,initqipandata[27]); _UpdataQipan(10, 9, initqipandata[29]); _UpdataQipan(8, 2, initqipandata[30]); _UpdataQipan(8, 8, initqipandata[31]);_UpdataQipan(7, 1, initqipandata[32]); _UpdataQipan(7, 3,initqipandata[33]); _UpdataQipan(7, 5, initqipandata[34]); _UpdataQipan(7, 7, initqipandata[35]); _UpdataQipan(7, 9, initqipandata[36]);}//获取棋子图片地址private string _GetImageAdd(int xxx){string x="" ;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select add_image from qizi where(no_qizi='"+xxx+"');", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())x = sr["add_image"].ToString();//Session["add_image"] = x;myconn.Close();return x;}//获取点击后的图片地址private string _GetImageDownAdd(int xxx){string x ="";SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select add_image_down from qizi where(no_qizi='" + xxx + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())x = sr["add_image_down"].ToString();myconn.Close();return x;}//读取鼠标点击点的坐标private int Getpointx(){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select x from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["x"].ToString());}myconn.Close();return x;}private int Getpointy( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select y from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["y"].ToString());}myconn.Close();return x;}private int Getpointlastx( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select lastx from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["lastx"].ToString());}myconn.Close();return x;}private int Getpointlasty( ){int x = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select lasty from zuobiao", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read()){x = int.Parse(sr["lasty"].ToString());}myconn.Close();return x;}//写入鼠标点击点的坐标private void Updatax(int xxx){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set x='" + xxx + "'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatay(int yyy){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set y='" + yyy + "'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatalastx(int lastxxx){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set lastx='"+lastxxx +"'" , myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}private void Updatalasty(int lastyyy){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update zuobiao set lasty='"+ lastyyy +"'", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//以上四个函数的集合,达到一次写入四个坐标值的目的private void _UpdataaZuobiao(int xxx, int yyy, int lastxxx, int lastyyy){Updatax(xxx);Updatay(yyy);Updatalastx(lastxxx);Updatalasty(lastyyy);}//保存当前坐标值到x和yprivate void _UpdatZuobiaoXY(int xxx, int yyy){if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 20){Updatax(xxx);Updatay(yyy);}if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 20){Updatax(xxx);Updatay(yyy);}}//读取棋盘上的棋子信息private int _GetDataQipan(int xxx, int yyy){int i,data=0;i = (xxx - 1) * 9 + yyy;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select data_qipan from qipan where(position='"+i+"')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["data_qipan"].ToString());myconn.Close();return data;}//将棋子信息写入棋盘private void _UpdataQipan(int xxx, int yyy,int data){int i;i = (xxx - 1) * 9 + yyy;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update qipan set data_qipan=" + data + "where (position='"+i+"')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//读出用户此时状态private int _GetUserState(string id){int data = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select state from yonghu where(id='" + id + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["state"].ToString());myconn.Close();return data;}//读出用户输赢状态 0表示在进行游戏 20表示赢 40表示输private int _GetUserWin(string id){int data = 0;SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("select winner from yonghu where(id='" + id + "')", myconn);myconn.Open();SqlDataReader sr = cmd.ExecuteReader();if (sr.Read())data = int.Parse(sr["winner"].ToString());myconn.Close();return data;}//写入用户状态private void _UpdataUserState(string id,int sta){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update yonghu set state="+ sta + "where (id='" + id + "')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}//写入用户输赢状态 0表示在进行游戏 20表示赢 40表示输private void _UpdataUserWin(string id, int sta){SqlConnection myconn = newSqlConnection(ConfigurationManager.ConnectionStrings["SQLCONNECTIONSTRIN G"].ConnectionString);SqlCommand cmd = new SqlCommand("update yonghu set winner=" + sta + "where (id='" + id + "')", myconn);myconn.Open();int aa = cmd.ExecuteNonQuery();myconn.Close();}protected void Page_Load(object sender, EventArgs e){_Init();// _Test();}//测试程序函数private void _Test(){_UpdataUserState("red",tru);_UpdataUserState("black", tru);}private bool_IsAbleToPut()//********************************************************需要传递x,y,laastx,lasty{if (Session["user"].ToString() == "red" &&_GetUserState(Session["user"].ToString()) == 40)return false;if (Session["user"].ToString() == "black" &&_GetUserState(Session["user"].ToString()) == 40)return false;int x, y, lastx, lasty;int qipandata,lastqipandata;x = Getpointx();y = Getpointy();lastx = Getpointlastx();lasty = Getpointlasty();if (Session["user"].ToString() == "black"){x = 11 - x;y = 10 - y;lastx = 11 - lastx;lasty = 10 - lasty;}qipandata = _GetDataQipan(x, y);lastqipandata = _GetDataQipan(lastx, lasty);// if (lastqipandata==0)// return false;if(Session["user"].ToString() == "red"&&(lastqipandata <= 20 || qipandata >=20))//****************************************************************现以红方为对象return false;if (Session["user"].ToString() == "black" && ((lastqipandata == 0 || lastqipandata >= 20) || (qipandata > 0 && qipandata <= 20)))return false;int i, j, c;//将|帅if (lastqipandata == 1 || lastqipandata == 21){if ((x - lastx) * (y - lasty) != 0) return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1) return false;if (y < 4 || y > 6 || (x > 3 && x < 8)) return false;return true;}//士|仕if (lastqipandata == 2 || lastqipandata == 3 || lastqipandata == 22 || lastqipandata == 23){if ((x - lastx) * (y - lasty) == 0) return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1) return false;if (y < 4 || y > 6 || (x > 3 && x < 8)) return false;return true;}//象|相if (lastqipandata == 4 || lastqipandata == 5 || lastqipandata == 24 || lastqipandata == 25){if ((x - lastx) * (y - lasty) == 0) return false;if (Math.Abs(x - lastx) != 2 || Math.Abs(y - lasty) != 2) return false;if(Session["user"].ToString() == "red"&& x < 6) return false;if (Session["user"].ToString() == "black" && x > 5) return false;i = 0; j = 0;//i,j必须有初始值if (x - lastx == 2){i = x - 1;}if (x - lastx == -2){i = x + 1;}if (y - lasty == 2){j = y - 1;}if (y - lasty == -2){j = y + 1;}if (_GetDataQipan(i, j) != 0) return false;return true;}//马if (lastqipandata == 6 || lastqipandata == 7 || lastqipandata == 26 || lastqipandata == 27){if (Math.Abs(x - lastx) * Math.Abs(y - lasty) != 2)return false;if (x - lastx == 2){if (_GetDataQipan(x - 1, lasty) != 0)return false;}if (x - lastx == -2){if (_GetDataQipan(x + 1, lasty) != 0)return false;}if (y - lasty == 2){if (_GetDataQipan(lastx, y - 1) != 0)return false;}if (y - lasty == -2){if (_GetDataQipan(lastx, y + 1) != 0)return false;}return true;}//车if (lastqipandata == 8 || lastqipandata == 9 || lastqipandata == 28 || lastqipandata == 29){//判断是否直线if ((x - lastx) * (y - lasty) != 0) return false;//判断是否隔有棋子if (x != lastx){if (lastx > x) { int t = x; x = lastx; lastx = t; }for (i = lastx; i <= x; i += 1){if (i != x && i != lastx){if (_GetDataQipan(i, y) != 0)return false;}}}if (y != lasty){if (lasty > y) { int t = y; y = lasty; lasty = t; }for (j = lasty; j <= y; j += 1){if (j != y && j != lasty){if (_GetDataQipan(x, j) != 0)return false;}}}return true;}//炮if (lastqipandata == 10 || lastqipandata == 11 || lastqipandata == 30 || lastqipandata == 31){bool swapflagx = false;bool swapflagy = false;if ((x - lastx) * (y - lasty) != 0) return false;c = 0;if (x != lastx){if (lastx > x) { int t = x; x = lastx; lastx = t; swapflagx = true; }for (i = lastx; i <= x; i += 1){if (i != x && i != lastx){if (_GetDataQipan(i, y) != 0)c = c + 1;//IsAbleToPut = False: Exit Function}}}if (y != lasty){if (lasty > y) { int t = y; y = lasty; lasty = t; swapflagy = true; }for (j = lasty; j <= y; j += 1){if (j != y && j != lasty){if (_GetDataQipan(x, j) != 0)c = c + 1;//IsAbleToPut = False: Exit Function}}}if (c > 1) return false; //与目标处间隔1个以上棋子if (c == 0) //与目标处无间隔棋子{if(swapflagx == true) { int t = x; x = lastx; lastx = t; }if(swapflagy == true) { int t = y; y = lasty; lasty = t; }if (_GetDataQipan(x, y) != 0) return false;}if (c == 1)//与目标处间隔1个棋子{if(swapflagx == true) { int t = x; x = lastx; lastx = t; }if(swapflagy == true) { int t = y; y = lasty; lasty = t; }// if ((IsMyChess(qipan[x, y]) || qipan[x, y] == 0))//return false;//***********ismychess************************************************** ***************************if (qipandata == 0)return false;}return true;}//卒|兵if (lastqipandata == 12 || lastqipandata == 13 || lastqipandata == 14 || lastqipandata == 15 || lastqipandata == 16 || lastqipandata == 32 || lastqipandata == 33 || lastqipandata == 34 || lastqipandata == 35 || lastqipandata == 36){if ((x - lastx) * (y - lasty) != 0)return false;if(Math.Abs(x - lastx) > 1 || Math.Abs(y - lasty) > 1)return false;if (Session["user"].ToString() == "red" && (x >= 6 && (y - lasty) != 0)) return false;if(Session["user"].ToString() == "black"&& (x <= 5 && (y - lasty) != 0)) return false;if(Session["user"].ToString() == "red"&& (x - lastx > 0)) return false;if(Session["user"].ToString() == "black"&& (x - lastx < 0)) return false;return true;}return false;}//移动棋子private void _MoveChess()//********************************************************需要传递x,y,laastx,lasty{//如果能移动则移动棋子if (_IsAbleToPut()){int x, y, lastx, lasty,qipandata, lastqipandata, tr;tr = 0;x = Getpointx();y = Getpointy();lastx = Getpointlastx();lasty = Getpointlasty();if (Session["user"].ToString() == "black"){x = 11 - x;y = 10 - y;lastx = 11 - lastx;lasty = 10 - lasty;}qipandata = _GetDataQipan(x, y);lastqipandata = _GetDataQipan(lastx, lasty);_UpdataQipan(x, y, lastqipandata);_UpdataQipan(lastx, lasty, tr);if (Session["user"].ToString() == "red"){_UpdataUserState("red", fals);_UpdataUserState("black", tru);}if (Session["user"].ToString() == "black"){_UpdataUserState("red", tru);_UpdataUserState("black", fals);}if (qipandata == 1){Response.Write("<script language=javascript>alert('恭喜您,您赢啦');</script>");_UpdataUserState("red", fals);_UpdataUserState("black", fals);Button6.Enabled = true;_UpdataUserWin("red",20);_UpdataUserWin("black", 40);}if (qipandata == 21){Response.Write("<script language=javascript>alert('恭喜您,您赢啦');</script>");_UpdataUserState("red", fals);_UpdataUserState("black", fals);Button6.Enabled = true;_UpdataUserWin("red", 40);_UpdataUserWin("black", 20);}_UpdataaZuobiao(0, 0, 0, 0);}//如果不能移动则更换已方被点击棋子的背景图片}protected void ImageButton1_Click1(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton2_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton3_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton4_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton5_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton6_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton7_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton8_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton9_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 1; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton11_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton12_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 2; _UpdatZuobiaoXY(x, y);_MoveChess(); _Drawqizi();}protected void ImageButton13_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton14_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton15_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton16_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton17_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton18_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton19_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 2; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton21_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton22_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton23_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton24_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton25_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton26_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton27_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton28_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 8; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton29_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 3; y = 9; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton31_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 1; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton32_Click(object sender,ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 2; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton33_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 3; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton34_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 4; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton35_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 5; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton36_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 6; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}protected void ImageButton37_Click(object sender, ImageClickEventArgs e){int x, y; SaveToLast(); x = 4; y = 7; _UpdatZuobiaoXY(x, y); _MoveChess(); _Drawqizi();}。

相关文档
最新文档