• 大小: 776KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-09
  • 语言: C#
  • 标签: 五子棋  c#  

资源简介

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个文件信息

评论

共有 条评论