资源简介
C# 开发的五子棋游戏,包含详细设计过程文档。课程设计+包含详细设计文档
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Media;
namespace 五子棋
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
m_renren = false;
first = true;
this.Paint += new PaintEventHandler(Form1_Paint);
Initializeqp();
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
//this.diannao.Click += new System.EventHandler(this.diannao_Click);
}
private bool sound=true;//是否播放声音
private bool begin = false;//是否开始
//private result[] theresult = new result[5];
private bool m_renren;//false表示人机对弈,true表示人人对弈
private bool first = true;//true表示人先下,false表示电脑先下(黑子先下)
//points为棋盘情况数组,points[ij]=2表示此处无子,points[ij]=1表示此处为黑子,points[ij]=0表示此处为白子
private int[] points= new int[15 15];
private int qzcolor = 1;//1为黑子,0为白子
private PictureBox[] qz = new PictureBox[15 15];//棋子
private Point oldMovePoint = new Point(-1 -1);
private int steps = 0;
private Stack backStack = new Stack();//用于悔棋的栈
private Stack backTrackStack = new Stack();//用于回溯的栈
const int M = 1;//预测的步数
private void Form1_Paint(object sender PaintEventArgs e)
{//绘制棋盘
int i;
Graphics g = e.Graphics;
// Image img = Image.FromFile(“image/qp.gif“);
//g.DrawImage(img 0 0 ClientRectangle.WidthClientRectangle.Height);
Pen myPen = new Pen(Color.Black 2);
SolidBrush brush = new SolidBrush(Color.Red);
for (i = 0; i < 15; i++)
{
g.DrawLine(myPen 30 + i * 40 50 30 + i * 40 610);
g.DrawLine(myPen 30 50 + i * 40 590 50 + i * 40);
}
g.FillEllipse(brush 306 326 8 8);
g.FillEllipse(brush 147 167 6 6);
g.FillEllipse(brush 467 167 6 6);
g.FillEllipse(brush 147 487 6 6);
g.FillEllipse(brush 467 487 6 6);
}
private void Initializeqp()//初始化棋盘
{
this.Paint += new PaintEventHandler(Form1_Paint);
int x y;
for (x = 0; x < 15; x++)
for (y = 0; y < 15; y++)
{
qz[x y] = new PictureBox();
qz[x y].Location = new Point(10 + x * 40 30 + y * 40);
qz[x y].Size = new Size(40 40);
qz[x y].BackColor = Color.Transparent;
qz[x y].SizeMode = PictureBoxSizeMode.CenterImage;
qz[x y].Visible = false;
this.Controls.Add(qz[x y]);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
.CA.... 99678 2006-05-15 13:53 五子棋\五子棋\bin\Debug\image\back.ico
.CA.... 1723 2007-03-03 14:06 五子棋\五子棋\bin\Debug\image\blackstone.gif
.CA.... 99678 2006-05-15 13:53 五子棋\五子棋\bin\Debug\image\cancel.ico
.CA.... 99678 2007-09-12 09:15 五子棋\五子棋\bin\Debug\image\change.ico
.CA.... 99678 2007-09-12 09:15 五子棋\五子棋\bin\Debug\image\exit.ico
.CA.... 1056 2007-03-05 10:06 五子棋\五子棋\bin\Debug\image\lastblackstone.gif
.CA.... 959 2007-03-05 10:07 五子棋\五子棋\bin\Debug\image\lastwhitestone.gif
.CA.... 799 2007-03-03 19:33 五子棋\五子棋\bin\Debug\image\null.gif
.CA.... 99678 2007-09-12 09:15 五子棋\五子棋\bin\Debug\image\restart.ico
.CA.... 99678 2007-09-12 09:15 五子棋\五子棋\bin\Debug\image\sound.ico
.CA.... 99678 2007-09-12 09:15 五子棋\五子棋\bin\Debug\image\soundstop.ico
.CA.... 99678 2007-09-12 09:16 五子棋\五子棋\bin\Debug\image\start.ico
.CA.... 1682 2007-03-03 14:06 五子棋\五子棋\bin\Debug\image\whitestone.gif
.CA.... 10462 2007-03-05 15:21 五子棋\五子棋\bin\Debug\image\五子棋图标.ico
.CA.... 1475 2008-01-13 21:05 五子棋\五子棋\bin\Debug\五子棋.application
.CA.... 184320 2008-01-13 21:05 五子棋\五子棋\bin\Debug\五子棋.exe
.CA.... 4482 2008-01-13 21:05 五子棋\五子棋\bin\Debug\五子棋.exe.manifest
.CA.... 58880 2008-01-13 21:05 五子棋\五子棋\bin\Debug\五子棋.pdb
.CA.... 423864 2007-11-12 19:37 五子棋\五子棋\bin\Debug\五子棋.publish\setup.exe
.CA.... 5182 2007-11-12 19:37 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋.application
.CA.... 1723 2007-03-03 14:06 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\blackstone.gif.deploy
.CA.... 1056 2007-03-05 10:06 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\lastblackstone.gif.deploy
.CA.... 959 2007-03-05 10:07 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\lastwhitestone.gif.deploy
.CA.... 799 2007-03-03 19:33 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\null.gif.deploy
.CA.... 1682 2007-03-03 14:06 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\whitestone.gif.deploy
.CA.... 10462 2007-03-05 15:21 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\bin\Debug\image\五子棋图标.ico.deploy
.CA.... 53248 2007-11-12 19:37 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\五子棋.exe.deploy
.CA.... 8134 2007-11-12 19:37 五子棋\五子棋\bin\Debug\五子棋.publish\五子棋_1_0_0_0\五子棋.exe.manifest
.CA.... 1475 2008-01-13 21:05 五子棋\五子棋\bin\Debug\五子棋.vshost.application
.CA.... 5632 2005-12-08 14:51 五子棋\五子棋\bin\Debug\五子棋.vshost.exe
............此处省略55个文件信息
- 上一篇:BrandNewShape简单流程图工具
- 下一篇:wpf的word操作
相关资源
- C# 调用win32 api函数-user32.dll详细说明
- C# 调用BarTender打印条码DEMO
- 大型比赛竞赛抽签系统 可打印 c# vs
- C#编写的Gerber查看器
- lua C# .Net4.0 vs2010 LuaInterface
- C#十六进制编辑器
- 明华URF-35H读卡器 C#读写源码 为大家
- C#文件流读取CSV文件
- c#读写PDF文件sql
- C# winform Socket大文件传输
- c#车牌识别系统附30张测试图片
- 《C#面向对象程序设计》源代码(CS)
- 金旭亮《C#面向对象程序设计》教案
- 试题库管理系统毕业论文(C#)源程序
- 学校网站原代码(C#.NET)
- C#-数据库操作技术-员工管理系统
- c#web开发入门经典
- C#与Matlab混合编程的几种方式
- c# 开发与 mysql数据库实现的增删改查
- C#异步操作 异步查询数据库 异步处理
- Basler相机通过IO触发源码
- [源代码] 《领域驱动设计 (C# 2008 实
- 松下PLC与C#通讯串口调试入门教程.z
- USB 继电器控制器 LCUS-1 保证能用 c#
- C# AES加密解密小工具
- C#圆形按钮,非常漂亮动态~~
- [精]C#仿QQ右下角弹出提示框()
- C#进程间通信-共享内存代码
- 有史以来最简单的三层(C#)
- vb调用c#编写的串口DLL文件(vb源码
评论
共有 条评论