資源簡介
改變環境大小 自行設置起點、終點、障礙物 建立四叉樹 計算出最優路徑 并在界面中表示出路徑與機器人運動狀況

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?Work
{
????public?partial?class?Form1?:?Form
????{
????????int?k1?=?20;?????????????//寬個數??列
????????int?k2?=?20;?????????????//高個數??行
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
???????
????????Rectangle[]?rect1?=?new?Rectangle[k2k1];
????????private?void?pictureBox1_Click(object?sender?EventArgs?e)
????????{
????????????
????????}
????????private?void?pictureBox1_Paint(object?sender?PaintEventArgs?e)
????????{
???????????
????????????Graphics?g?=?this.CreateGraphics();
????????????Pen?p?=?new?Pen(Color.Black?1);
????????????Rectangle?rect?=?pictureBox1.Bounds;
????????????//畫網格
????????????//?網格的列數20??col為小矩形寬
????????????double?col?=?(double)(rect.Width?-?1)?/?k1;
????????????//?網格的行數20??row為小矩形高
????????????double?row?=?(double)(rect.Height?-?1)?/?k2;
????????????double?drawCol?=?0;
????????????double?drawRow?=?0;
????????????//?畫水平線
????????????for?(int?i?=?0;?i?<=?k2?+?1;?i++)
????????????{
????????????????e.Graphics.DrawLine(p?0?(float)drawCol?(float)rect.Width?(float)drawCol);
????????????????drawCol?+=?row;
????????????}
????????????//?畫垂直線
????????????for?(int?j?=?0;?j?<=?k1?+?1;?j++)
????????????{
????????????????e.Graphics.DrawLine(p?(float)drawRow?0?(float)drawRow?rect.Height);
????????????????drawRow?+=?col;
????????????}
????????????//if?(ischange?==?true)
????????????//{
????????????//????string?st1?=?textBox1.Text;????//寬個數
????????????//????string?st2?=?textBox2.Text;//???高個數
????????????//????k1?=?Convert.ToInt32(st1);
????????????//????k2?=?Convert.ToInt32(st2);
????????????//????//?網格的列數k1??col為小矩形寬
????????????//????col?=?(double)(rect.Width?-?1)?/?k1;
????????????//????//?網格的行數k2??row為小矩形高
????????????//????row?=?(double)(rect.Height?-?1)?/?k2;
????????????//????drawCol?=?0;
????????????//????drawRow?=?0;
????????????//????e.Graphics.Clear(this.BackColor);
????????????//?????//畫網格
????????????//?????//?畫水平線
????????????//????for?(int?i?=?0;?i?<=?k2?+?1;?i++)
????????????//????{
????????????//????????e.Graphics.DrawLine(p?0?(float)drawCol?(float)rect.Width?(float)drawCol);
????????????//????????drawCol?+=?row;
????????????//????}
????????????//????//?畫垂直線
????????????//????for?(int?j?=?0;?j?<=?k1?+?1;?j++)
????????????//????{
????????????//????????e.Graphics.DrawLine(p?(float)drawRow?0?(float)drawRow?rect.Height);
????????????//????????drawRow?+=?col;
????????????//????}
????????????//}
????????????
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????}
????????private?void?listView1_SelectedIndexChanged(object?sender?EventArgs?e)
????????{
????????}
????????private?void?groupBo
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A..H.?????50688??2017-07-14?22:49??Work\.vs\Work\v14\.suo
?????文件????????189??2017-07-10?19:37??Work\Work\App.config
?????文件??????24064??2017-07-15?09:35??Work\Work\bin\Debug\Work.exe
?????文件????????189??2017-07-10?19:37??Work\Work\bin\Debug\Work.exe.config
?????文件??????46592??2017-07-15?09:35??Work\Work\bin\Debug\Work.pdb
?????文件??????22696??2017-07-15?09:17??Work\Work\bin\Debug\Work.vshost.exe
?????文件????????189??2017-07-10?19:37??Work\Work\bin\Debug\Work.vshost.exe.config
?????文件????????490??2016-07-16?19:44??Work\Work\bin\Debug\Work.vshost.exe.manifest
?????文件???????4405??2017-07-11?16:28??Work\Work\Form1.cs
?????文件??????11146??2017-07-11?15:54??Work\Work\Form1.Designer.cs
?????文件???????9509??2017-07-11?15:54??Work\Work\Form1.resx
?????文件??????22121??2017-07-15?09:35??Work\Work\Form190.cs
?????文件??????11861??2017-07-14?22:47??Work\Work\Form190.Designer.cs
?????文件???????9704??2017-07-14?22:47??Work\Work\Form190.resx
?????文件???????1464??2017-07-11?09:00??Work\Work\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7035??2017-07-14?14:39??Work\Work\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2017-07-10?19:37??Work\Work\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2017-07-10?19:37??Work\Work\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2017-07-10?19:37??Work\Work\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件????????903??2017-07-15?09:17??Work\Work\obj\Debug\Work.csproj.FileListAbsolute.txt
?????文件???????1036??2017-07-15?09:09??Work\Work\obj\Debug\Work.csproj.GenerateResource.Cache
?????文件???????2384??2017-07-10?19:43??Work\Work\obj\Debug\Work.csprojResolveAssemblyReference.cache
?????文件??????24064??2017-07-15?09:35??Work\Work\obj\Debug\Work.exe
?????文件???????2601??2017-07-15?09:09??Work\Work\obj\Debug\Work.Form1.resources
?????文件??????46592??2017-07-15?09:35??Work\Work\obj\Debug\Work.pdb
?????文件????????180??2017-07-11?16:29??Work\Work\obj\Debug\Work.Properties.Resources.resources
?????文件????????516??2017-07-10?19:37??Work\Work\Program.cs
?????文件???????1316??2017-07-10?19:37??Work\Work\Properties\AssemblyInfo.cs
?????文件???????2821??2017-07-10?19:37??Work\Work\Properties\Resources.Designer.cs
?????文件???????5612??2017-07-10?19:37??Work\Work\Properties\Resources.resx
............此處省略19個文件信息
- 上一篇:武漢大學2016年地理信息專業夏令營編程
- 下一篇:機房管理系統課程設計
評論
共有 條評論