• 基于C#实现的巧移火柴棍(火柴棍移动)


    目录
    1 任务描述 1
    2 问题建模 1
    2.1 状态空间 1
    3 算法设计和实现 2
    3.1 数据组织结构 2
    3.2 搜索算法 3
    3.2.1 暴力搜索(for 循环) 4
    3.2.2 深度优先搜索 5
    3.2.3 算法性能对比 7
    3.3 等式处理算法 7
    3.4 数据库类 8
    4UI 设计和使用说明 9
    4.1 编译和运行环境 9
    4.2 运行方式 9
    4.2 界面设计 9
    (1)开始界面 10
    (2)游戏主界面 11
    5 实验总结 12
    5.1 项目亮点 12
    (1)功能齐全,界面美观 12
    (2)连接数据库 13
    5.2 存在的问题及可改进之处 13
    (1)等式局限性 13
    (2)移动两根火柴的 dfs 算法实现 13
    5.3 心得体会 13
    6 参考文献 13

    4UI 设计和使用说明
    4.1编译和运行环境
    本程序为在 VS2012 平台上使用 C#语言编写的 Windows 应用程序,编译和运行于.NET Framework 4.5.
    4.2运行方式
    Windows 系统下双击文件𝑚𝑎𝑡𝑐ℎ的𝑏𝑖𝑛目录中𝐷𝑒𝑏𝑢𝑔下的𝑚𝑎𝑡𝑐ℎ. 𝑒𝑥𝑒即可直接运行。
    4.2 界面设计
    (1)开始界面
    开始界面如图 6 所示,点击按钮“开始游戏”进入游戏界面,点击“游戏玩法”查看游戏玩法说明,点击“退出”关闭程序。
    5实验总结

    5.1项目亮点

    (1)功能齐全,界面美观
    本程序实现了作业要求中的全部必做和选做要求,提供了题库出题、自主出题和随机出题三种出题模式,游戏过程中,玩家可以自行选择、调整适合自己的题目难度以及移动火柴的根数,并且在移动一根的情况下提供 for 循环搜索和 dfs 递归搜索两种搜索方式的选择, 结合下方的搜索用时,本文转载自http://www.biyezuopin.vip/onews.asp?id=16743让玩家更好的认识两种算法的搜索效率,丰富了程序的交互体验。

    另外,使用 C#工具 skinEngine 对界面进行整体美化,在尝试了多种界面皮肤后选择了
    𝐷𝑒𝑒𝑝𝑐𝑦𝑎𝑛皮肤,整体统一的界面风格让使用者有更优的感官体验。
    (2)连接数据库
    为了满足从特定等式库出题的要求,为程序接入 SQLite 数据库,数据库的引入有助于大量数据的处理,玩家可以按照自身需求自行向数据库𝑚𝑎𝑡𝑐ℎ_𝑑𝑏. 𝑑𝑏中批量导入等式,在游戏中呈现并求解,更加人性化;程序开发者结合数据库相关的 GUI 软件也可以更加便捷的增补、删改等式库。

    namespace match
    {
        partial class menu
        {
            /// 
            /// Required designer variable.
            /// 
            private System.ComponentModel.IContainer components = null;
    
            /// 
            /// Clean up any resources being used.
            /// 
            /// true if managed resources should be disposed; otherwise, false.
            protected override void Dispose(bool disposing)
            {
                if (disposing && (components != null))
                {
                    components.Dispose();
                }
                base.Dispose(disposing);
            }
    
            #region Windows Form Designer generated code
    
            /// 
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// 
            private void InitializeComponent()
            {
                this.label1 = new System.Windows.Forms.Label();
                this.start = new System.Windows.Forms.Button();
                this.help = new System.Windows.Forms.Button();
                this.leave = new System.Windows.Forms.Button();
                this.skinEngine1 = new Sunisoft.IrisSkin.SkinEngine(((System.ComponentModel.Component)(this)));
                this.SuspendLayout();
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Font = new System.Drawing.Font("楷体", 42F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
                this.label1.Location = new System.Drawing.Point(72, 57);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(385, 70);
                this.label1.TabIndex = 0;
                this.label1.Text = "巧移火柴棍";
                this.label1.Click += new System.EventHandler(this.label1_Click);
                // 
                // start
                // 
                this.start.Location = new System.Drawing.Point(124, 184);
                this.start.Name = "start";
                this.start.Size = new System.Drawing.Size(100, 34);
                this.start.TabIndex = 1;
                this.start.Text = "开始游戏";
                this.start.UseVisualStyleBackColor = true;
                this.start.Click += new System.EventHandler(this.start_Click);
                // 
                // help
                // 
                this.help.Location = new System.Drawing.Point(124, 255);
                this.help.Name = "help";
                this.help.Size = new System.Drawing.Size(100, 34);
                this.help.TabIndex = 2;
                this.help.Text = "游戏玩法";
                this.help.UseVisualStyleBackColor = true;
                this.help.Click += new System.EventHandler(this.help_Click);
                // 
                // leave
                // 
                this.leave.Location = new System.Drawing.Point(124, 326);
                this.leave.Name = "leave";
                this.leave.Size = new System.Drawing.Size(100, 34);
                this.leave.TabIndex = 3;
                this.leave.Text = "退出";
                this.leave.UseVisualStyleBackColor = true;
                this.leave.Click += new System.EventHandler(this.leave_Click);
                // 
                // skinEngine1
                // 
                this.skinEngine1.SerialNumber = "";
                this.skinEngine1.SkinFile = null;
                // 
                // menu
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.BackColor = System.Drawing.SystemColors.HighlightText;
                this.BackgroundImage = global::match.Properties.Resources.menu_bg;
                this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
                this.ClientSize = new System.Drawing.Size(703, 499);
                this.Controls.Add(this.leave);
                this.Controls.Add(this.help);
                this.Controls.Add(this.start);
                this.Controls.Add(this.label1);
                this.Name = "menu";
                this.Text = "开始菜单";
                this.Load += new System.EventHandler(this.menu_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            #endregion
    
            private System.Windows.Forms.Label label1;
            private System.Windows.Forms.Button start;
            private System.Windows.Forms.Button help;
            private System.Windows.Forms.Button leave;
            private Sunisoft.IrisSkin.SkinEngine skinEngine1;
        }
    }
    
    • 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
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

  • 相关阅读:
    小程序开发--- 03组件
    面试碰壁15次,作为一个26岁的测试工程师,感到未来迷茫...
    windows安装mysql
    HarmonyOS系统内核中消息队列的实现
    基于SpringBoot+Vue点餐平台网站设计和实现(源码+LW+部署文档+讲解等)
    李宏毅2022机器学习HW3 Image Classification
    生产升级JDK 17 必读手册
    第十三届蓝桥杯c++b组2022年国赛决赛题解
    第二证券|六大券商热议“第三支箭”:再融资重启修复市场预期
    百万数据 mysql count(*)优化
  • 原文地址:https://blog.csdn.net/newlw/article/details/126886225