資源簡(jiǎn)介
簡(jiǎn)單的元胞自動(dòng)機(jī)模型,可以自定義矩陣大小,演算步數(shù),可以鼠標(biāo)手動(dòng)繪制初始圖形。
代碼片段和文件信息
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;
using?System.Collections;
namespace?生命游戲
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????public?static?int?matrixwide;//矩陣的長(zhǎng)寬
????????public?static?int?matrixheight;
????????public?static?int[]?cellmatrix;
????????public?static?int?maxstep;
????????public?static?ArrayList?recordlist?=?new?ArrayList();
????????
????????
????????
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????matrixwide?=?Convert.ToInt32(textBox1.Text);
????????????matrixheight?=?Convert.ToInt32(textBox2.Text);
????????????this.establishmatrix();
????????????Form2?frm2?=?new?Form2();
????????????frm2.Show();
????????????
????????????
????????}
????????public?void?establishmatrix()
????????{
????????????//建立矩陣的代碼
????????????maxstep?=?Convert.ToInt32(textBox3.Text);
????????????cellmatrix?=?new?int[matrixwide?matrixheight];
????????????for?(int?mcountx?=?0;?mcountx?????????????{
????????????????for?(int?mcounty?=?0;?mcounty?????????????????{
????????????????????cellmatrix[mcountx?mcounty]?=?0;
????????????????}
????????????}
????????????for?(int?cacount=0;?cacount?(maxstep+1)?*?matrixheight?*?matrixwide;?cacount++)
????????????{
????????????????recordlist.Add(0);
????????????}
????????????MessageBox.Show(“矩陣,數(shù)組建立完畢大小:“+matrixwide+“*“+matrixheight+“arraylist“+(maxstep?*?matrixheight?*?matrixwide));
???????????
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????//隨即生成生命
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件????????187??2013-04-21?22:40??生命游戲\生命游戲\App.config
?????文件??????18432??2013-04-27?08:43??生命游戲\生命游戲\bin\Debug\生命游戲.exe
?????文件????????187??2013-04-21?22:40??生命游戲\生命游戲\bin\Debug\生命游戲.exe.config
?????文件??????44544??2013-04-27?08:43??生命游戲\生命游戲\bin\Debug\生命游戲.pdb
?????文件??????22984??2013-04-27?08:43??生命游戲\生命游戲\bin\Debug\生命游戲.vshost.exe
?????文件????????187??2013-04-21?22:40??生命游戲\生命游戲\bin\Debug\生命游戲.vshost.exe.config
?????文件????????490??2010-03-17?22:39??生命游戲\生命游戲\bin\Debug\生命游戲.vshost.exe.manifest
?????文件???????1954??2013-04-22?13:47??生命游戲\生命游戲\Form1.cs
?????文件???????5117??2013-04-22?13:47??生命游戲\生命游戲\Form1.Designer.cs
?????文件???????5817??2013-04-22?13:47??生命游戲\生命游戲\Form1.resx
?????文件??????14349??2013-04-27?08:43??生命游戲\生命游戲\Form2.cs
?????文件???????7386??2013-04-24?08:30??生命游戲\生命游戲\Form2.Designer.cs
?????文件???????6206??2013-04-23?17:21??生命游戲\生命游戲\Form2.resx
?????文件????????505??2013-04-22?06:43??生命游戲\生命游戲\Form3.cs
?????文件???????3045??2013-04-22?06:36??生命游戲\生命游戲\Form3.Designer.cs
?????文件???????5817??2013-04-22?06:36??生命游戲\生命游戲\Form3.resx
?????文件???????1308??2013-04-22?10:14??生命游戲\生命游戲\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????7027??2013-04-23?14:36??生命游戲\生命游戲\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件??????????0??2013-04-21?22:40??生命游戲\生命游戲\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件??????????0??2013-04-21?22:40??生命游戲\生命游戲\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件??????????0??2013-04-21?22:40??生命游戲\生命游戲\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????文件???????2227??2013-04-27?08:43??生命游戲\生命游戲\obj\Debug\生命游戲.csproj.FileListAbsolute.txt
?????文件???????1091??2013-04-23?17:21??生命游戲\生命游戲\obj\Debug\生命游戲.csproj.GenerateResource.Cache
?????文件???????2209??2013-04-21?22:57??生命游戲\生命游戲\obj\Debug\生命游戲.csprojResolveAssemblyReference.cache
?????文件??????18432??2013-04-27?08:43??生命游戲\生命游戲\obj\Debug\生命游戲.exe
?????文件????????180??2013-04-22?13:47??生命游戲\生命游戲\obj\Debug\生命游戲.Form1.resources
?????文件????????180??2013-04-23?17:21??生命游戲\生命游戲\obj\Debug\生命游戲.Form2.resources
?????文件????????180??2013-04-22?06:36??生命游戲\生命游戲\obj\Debug\生命游戲.Form3.resources
?????文件??????44544??2013-04-27?08:43??生命游戲\生命游戲\obj\Debug\生命游戲.pdb
?????文件????????180??2013-04-22?06:36??生命游戲\生命游戲\obj\Debug\生命游戲.Properties.Resources.resources
............此處省略21個(gè)文件信息
評(píng)論
共有 條評(píng)論