资源简介
网络对战五子棋采用c#编程语言实现,基于(c/s)模式编写。网络工程专业学生实训项目源代码,仅用于学习用途。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Collections;
namespace Gobang
{
public struct CobbleLocation
{
public int row;
public int column;
}
public partial class Form1 : Form
{
//以下数据设置比例与窗体Size有关,单位是像素,当前Size为(506583)
int LINE_SPACE = 32;
int LINE_COUNT = 15;
int CENTER_RADIUS = 3; //天元位置小圆点的半径
int COBBLE_RADIUS = 15;//棋子半径
//本客户端用户棋子颜色标记
bool IS_WHITE_LOCAL_COBBLE_COLOR = true;
//棋盘交叉点矩形区域
Rectangle[] crossPointRects;
//棋盘信息变量
int BoardCenterX;
int BoardCenterY;
int BoardLineLength;
int BoardLeft;
int BoardTop;
Rectangle BoardRect;
//用户鼠标位置
int mouseCurrentX;
int mouseCurrentY;
//canPut用以判断是否可以落子
bool canPut ;
//黑白子重画
ArrayList blackswhites;
//焦点棋子
CobbleLocation focusCobble;
//套接字
TcpClient tcpClient;
//标记是否游戏正在进行
bool playing = false;
//联珠五子
ArrayList winFive;
public Form1()
{
InitializeComponent();
BoardCenterX = ClientSize.Width / 2;
BoardCenterY = ClientSize.Height / 2 + toolStrip1.Height;
BoardLineLength = LINE_SPACE * (LINE_COUNT - 1);
BoardLeft = BoardCenterX - LINE_SPACE * ((LINE_COUNT - 1) / 2);
BoardTop = BoardCenterY - LINE_SPACE * ((LINE_COUNT - 1) / 2);
BoardRect = new Rectangle(BoardLeft BoardTop BoardLineLength BoardLineLength);
crossPointRects = new Rectangle[LINE_COUNT LINE_COUNT];
initializePointsArray();
blacks = new ArrayList();
whites = new ArrayList();
winFive = new ArrayList();
Setstyle(Controlstyles.UserPaint | Controlstyles.DoubleBuffer | Controlstyles.AllPaintingInWmPaint true);
}
private void newGobang()
{
blacks.Clear();
whites.Clear();
winFive.Clear();
Refresh();
focusCobble.row = -1;
focusCobble.column = -1;
if(IS_WHITE_LOCAL_COBBLE_COLOR) canPut=false;
else canPut=true;
playing = true;
if (IS_WHITE_LOCAL_COBBLE_COLOR)
{
tcpClient.Send(“请执黑先行“);
}
else
MessageBox.Show(“执黑先行“);
timer1.Tick += new EventHandler(waitPut);
timer1.Enabled = true;
}
private void Form1_Paint(object sender PaintEventArgs e)
{
//画棋盘的方法
drawBoard(e.Graphics);
//画黑子的方法
drawBlacks(e.Gr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 828118 2006-05-05 20:46 GobangServer\GobangServer\BackGround.bmp
文件 1691648 2006-05-09 00:17 GobangServer\GobangServer\bin\Debug\GobangServer.exe
文件 46592 2006-05-09 00:17 GobangServer\GobangServer\bin\Debug\GobangServer.pdb
文件 5632 2005-11-11 22:25 GobangServer\GobangServer\bin\Debug\GobangServer.vshost.exe
文件 2518 2006-05-06 12:14 GobangServer\GobangServer\Deli
文件 18786 2006-05-09 00:39 GobangServer\GobangServer\Form1.cs
文件 8159 2006-05-09 00:39 GobangServer\GobangServer\Form1.Designer.cs
文件 1249222 2006-05-09 00:39 GobangServer\GobangServer\Form1.resx
文件 3508 2006-05-06 12:34 GobangServer\GobangServer\GobangServer.csproj
文件 2406 2006-05-06 09:50 GobangServer\GobangServer\li
文件 934 2006-05-07 20:10 GobangServer\GobangServer\obj\Debug\GobangServer.csproj.GenerateResource.Cache
文件 1691648 2006-05-09 00:17 GobangServer\GobangServer\obj\Debug\GobangServer.exe
文件 828952 2006-05-07 20:10 GobangServer\GobangServer\obj\Debug\GobangServer.Form1.resources
文件 46592 2006-05-09 00:17 GobangServer\GobangServer\obj\Debug\GobangServer.pdb
文件 833030 2006-05-06 12:55 GobangServer\GobangServer\obj\Debug\GobangServer.Properties.Resources.resources
文件 5120 2006-05-06 12:34 GobangServer\GobangServer\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
文件 303 2006-05-09 00:18 GobangServer\GobangServer\obj\GobangServer.csproj.FileList.txt
文件 471 2006-05-06 11:39 GobangServer\GobangServer\Program.cs
文件 1174 2006-05-06 11:39 GobangServer\GobangServer\Properties\AssemblyInfo.cs
文件 3603 2006-05-06 12:34 GobangServer\GobangServer\Properties\Resources.Designer.cs
文件 6657 2006-05-06 12:34 GobangServer\GobangServer\Properties\Resources.resx
文件 1108 2006-05-06 11:47 GobangServer\GobangServer\Properties\Settings.Designer.cs
文件 249 2006-05-06 11:39 GobangServer\GobangServer\Properties\Settings.settings
文件 2744 2006-05-09 00:17 GobangServer\GobangServer\TcpServer.cs
文件 925 2006-05-06 11:39 GobangServer\GobangServer.sln
..A..H. 16896 2006-05-09 00:39 GobangServer\GobangServer.suo
文件 74 2006-05-06 09:19 GobangClient\Backup\Gobang\app.config
文件 828118 2006-05-05 20:46 GobangClient\Backup\Gobang\BackGround.bmp
文件 2518 2006-05-06 12:14 GobangClient\Backup\Gobang\Deli
文件 19019 2006-05-07 23:14 GobangClient\Backup\Gobang\Form1.cs
............此处省略80个文件信息
相关资源
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
评论
共有 条评论