資源簡介
使用方法 和五子棋一樣 我就不廢話了
諤諤 這個字數有點難籌齊

代碼片段和文件信息
using?System;
using?System.Drawing;
using?System.Windows.Forms;
using?Microsoft.VisualBasic.PowerPacks;
namespace?圍棋2//解決方案?使用數組解決問題?:將相鄰的子放進一個數組?然后判斷這些子的氣?如果所有子的氣為0?則遍歷吃掉這些子
{
????public?partial?class?Form1?:?Form
????{
????????int[]?ai?=?new?int[13?13];//存數據的
????????int[]?bi?=?new?int[100];//存黑棋和白棋
????????int[]?cc?=?new?int[100];//分組存的
????????static?int?bo?=?0;//設置誰下
????????ShapeContainer?sh?=?new?ShapeContainer();//畫棋盤的容器
????????const?int?f?=?30?f2?=?40;//設置常量
????????public?Form1()
????????{
????????????Text?=?“圍棋--作者:彳亍樂兒“;
????????????StartPosition?=?FormStartPosition.CenterScreen;
????????????BackColor?=?Color.Gray;
????????????Size?=?new?Size(580?590);
????????????Controls.Add(sh);
????????????KeyPreview?=?true;
????????????MouseDown?+=?new?MouseEventHandler(md);//布局
????????????for?(int?y?=?1?x?=?1?x2?=?13;?y?14;?y++)//這個循環用來畫棋盤
????????????{
????????????????LineShape?a?=?new?LineShape(x?*?f2?y?*?f2?x2?*?f2?y?*?f2);
????????????????LineShape?b?=?new?LineShape(y?*?f2?x?*?f2?y?*?f2?x2?*?f2);
????????????????a.Tag?=?b.Tag?=?10000;
????????????????a.Enabled?=?b.Enabled?=?false;//這一步很重要
????????????????sh.Shapes.AddRange(new?Shape[]?{?a?b?});
????????????}
????????}
????????private?void?md(object?sender?MouseEventArgs?e)//鼠標點擊事件
????????{
????????????int?d?=?dingwei(e.Location);
????????????if?(d?!=?0)
????????????{
????????????????bo++;
????????????????OvalShape?a?=?new?OvalShape();
????????????????a.Size?=?new?Size(f?f);
????????????????a.Location?=?new?Point(d?/?100?*?f2?-?f?/?2?d?%?100?*?f2?-?f?/?2);
????????????????a.Backstyle?=?Backstyle.Opaque;
????????????????a.Tag?=?d-101;
????????????????if?(bo?%?2?==?0)
????????????????{
????????????????????a.BackColor?=?Color.White;
????????????????????panduan(1);
????????????????}
????????????????else
????????????????????a.BackColor?=?Color.Black;
????????????????sh.Shapes.Add(a);
????????????????panduan(2);
????????????????panduan(1);
????????????}
????????}
????????int?dingwei(Point?p)//定位判斷
????????{
????????????for?(int?a?=?1;?a?14;?a++)
????????????????for?(int?b?=?1;?b?14;?b++)
????????????????????if?(Math.Abs(p.X?-?a?*?f2)?15?&&?Math.Abs(p.Y?-?b?*?f2)?15)
????????????????????{
????????????????????????ai[a?-?1?b?-?1]?=?bo?%?2?+?1;
????????????????????????return?a?*?100?+?b;
????????????????????}
????????????return?0;
????????}
????????void?panduan(int?h)
????????{
????????????int?b2=0;
????????????for?(int?i?=?0;?i?13;?i++)
????????????????for?(int?l?=?0;?l?13;?l++)
????????????????????if?(ai[i?l]?==?h)
????????????????????????bi[b2++]?=?i?*?100?+?l;//麻煩了點?還是弄到了所有黑子的坐標
????????????for?(int?i?=?0;?i?100;?i++)
????????????????cc[i]?=?0;
????????????int?t?=?1;
????????????for?(int?i?=?0;?i?????????????????if?(cc[i]?==?0)
????????????????{
????????????????????cc[i]?=?t++;
????????????????????xunzhao(bi[i]?t?-?1b2);//將其分組
????????????????}
????????????for?(int?i
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????516??2012-03-09?03:07??圍棋2\代碼說明.txt
?????文件??????10752??2012-03-09?02:52??圍棋2\圍棋2\bin\Debug\圍棋2.exe
?????文件??????28160??2012-03-09?02:52??圍棋2\圍棋2\bin\Debug\圍棋2.pdb
?????文件??????11600??2012-03-09?02:56??圍棋2\圍棋2\bin\Debug\圍棋2.vshost.exe
?????文件????????490??2010-03-17?22:39??圍棋2\圍棋2\bin\Debug\圍棋2.vshost.exe.manifest
?????文件???????5048??2012-03-09?02:52??圍棋2\圍棋2\Form1.cs
?????文件???????1396??2012-03-09?01:46??圍棋2\圍棋2\Form1.Designer.cs
?????文件???????5817??2012-03-08?10:18??圍棋2\圍棋2\Form1.resx
?????文件???????4440??2012-03-09?01:45??圍棋2\圍棋2\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6552??2012-03-09?02:56??圍棋2\圍棋2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????754??2012-03-08?10:18??圍棋2\圍棋2\obj\x86\Debug\GenerateResource.read.1.tlog
?????文件???????1124??2012-03-08?10:18??圍棋2\圍棋2\obj\x86\Debug\GenerateResource.write.1.tlog
?????文件??????12818??2012-03-09?01:46??圍棋2\圍棋2\obj\x86\Debug\ResolveAssemblyReference.cache
?????文件???????2287??2012-03-09?02:56??圍棋2\圍棋2\obj\x86\Debug\圍棋2.csproj.FileListAbsolute.txt
?????文件??????10752??2012-03-09?02:52??圍棋2\圍棋2\obj\x86\Debug\圍棋2.exe
?????文件????????180??2012-03-08?10:18??圍棋2\圍棋2\obj\x86\Debug\圍棋2.Form1.resources
?????文件??????28160??2012-03-09?02:52??圍棋2\圍棋2\obj\x86\Debug\圍棋2.pdb
?????文件????????180??2012-03-08?09:05??圍棋2\圍棋2\obj\x86\Debug\圍棋2.Properties.Resources.resources
?????文件????????488??2012-03-04?23:52??圍棋2\圍棋2\Program.cs
?????文件???????1370??2012-03-04?23:52??圍棋2\圍棋2\Properties\AssemblyInfo.cs
?????文件???????2864??2012-03-04?23:52??圍棋2\圍棋2\Properties\Resources.Designer.cs
?????文件???????5612??2012-03-04?23:52??圍棋2\圍棋2\Properties\Resources.resx
?????文件???????1092??2012-03-04?23:52??圍棋2\圍棋2\Properties\Settings.Designer.cs
?????文件????????249??2012-03-04?23:52??圍棋2\圍棋2\Properties\Settings.settings
?????文件???????3885??2012-03-05?06:35??圍棋2\圍棋2\圍棋2.csproj
?????文件????????143??2012-03-05?06:35??圍棋2\圍棋2\圍棋2.csproj.user
?????文件????????863??2012-03-05?06:35??圍棋2\圍棋2.sln
????..A..H.?????24064??2012-03-09?07:22??圍棋2\圍棋2.suo
?????目錄??????????0??2012-03-05?06:35??圍棋2\圍棋2\obj\x86\Debug\TempPE
?????目錄??????????0??2012-03-09?02:52??圍棋2\圍棋2\obj\x86\Debug
............此處省略12個文件信息
- 上一篇:C#畫多條二維曲線圖
- 下一篇:C#調用excel批量計算源代碼
評論
共有 條評論