form1.cs
来自「c#实现的传教士野人过算法。这是一个框架」· CS 代码 · 共 56 行
CS
56 行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace AIShow
{
public partial class Form1 : Form
{
Thread t;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//不对跨线程调用做检查
CheckForIllegalCrossThreadCalls = false;
//产生操作算子
MCState.produceOpMetas();
//起始状态
MCState source=new MCState();
source.m=3;
source.c=3;
source.b=1;
//目标状态
MCState target=new MCState();
target.m=0;
target.c=0;
target.b=0;
//深度优先算法
DepthFirstSearch dfs = new DepthFirstSearch();
dfs.sourceState = source;
dfs.targetState = target;
dfs.textDisplay = this.textBox1;
// dfs.search();
ThreadStart ts = new ThreadStart(dfs.search);
t = new Thread(ts);
t.Start();
}
private void button2_Click(object sender, EventArgs e)
{
if (t != null)
t.Abort();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?