QQ连连看的游戏辅助程序源代码 C#

时间:2016-07-17 03:37:12
【文件属性】:
文件名称:QQ连连看的游戏辅助程序源代码 C#
文件大小:105KB
文件格式:ZIP
更新时间:2016-07-17 03:37:12
C# QQ连连看 是win7 x64版的主要算法代码如下: public class robot { public robot(byte[] robotbyte,int x,int y) { this.robotbyte = new byte[x,y]; for (int j = 0; j < y; j++) { for (int i = 0; i < x; i++) { this.robotbyte[i, j] = robotbyte[j * x + i]; } } this.backupbyte = new byte[x, y]; this.backupbyte = this.robotbyte; this.robotheight = y; this.robotwidth = x; this.steps = new List(); this.firstpoint = new Point(0, 0); this.secondpoint = new Point(1,0); } public byte[,] robotbyte; public byte[,] backupbyte; public int robotwidth; public int robotheight; public int unitcount; public int bushu; private Point firstpoint; private Point secondpoint; public List steps; private bool dealroundpoint(Point firstp,out Point secondp) { bool isconnect = false; if (robotbyte[firstp.X, firstp.Y] == GetValueByPos(new Point(firstp.X,firstp.Y-1))) { secondp = new Point(firstp.X, firstp.Y - 1); isconnect = true; } else { if (robotbyte[firstp.X, firstp.Y] ==GetValueByPos(new Point(firstp.X+1,firstp.Y))) { secondp = new Point(firstp.X + 1, firstp.Y); isconnect = true; } else { if (robotbyte[firstp.X, firstp.Y] == GetValueByPos(new Point(firstp.X-1,firstp.Y))) { secondp = new Point(firstp.X - 1, firstp.Y); isconnect=true; } else { if (robotbyte[firstp.X, firstp.Y] == GetValueByPos(new Point(firstp.X,firstp.Y+1))) { secondp = new Point(firstp.X, firstp.Y + 1); isconnect = true; } else { secondp = firstp; } } } } return isconnect; } private bool shulinepoint(Point firstp, Point secondp,Point range) { bool isconnect=false; if (firstp.Y > secondp.Y) { Point tempp = firstp; firstp = secondp; secondp = firstp; } for (int i=range.X; i <=range.Y; i++) { for (int j=firstp.Y+1; j secondp.X) { Point tempp = firstp; firstp = secondp; secondp = firstp; } for (int i =range.X; i <=range.Y; i++) { for (int j = firstp.X+1; j sp.Y) { if (fp.X <= sp.Y) { isjiao = true; } } else if (fp.Y == sp.Y) { isjiao = true; } else { if (fp.Y >= sp.X) { isjiao = true; } } if (isjiao) { range.X = Math.Max(fp.X, sp.X); range.Y = Math.Min(fp.Y, sp.Y); } return isjiao; } private Point GetXRange(Point tempp) { int min=tempp.X; int max=tempp.X; while (min >0) { min--; if (robotbyte[min, tempp.Y] != 0) { min = min + 1; break; } } while (max < this.robotheight-1) { max++; if (robotbyte[max,tempp.Y] != 0) { max = max - 1; break; } } return new Point(min, max); } private Point GetYRange(Point tempp) { int min = tempp.Y; int max = tempp.Y; while (min>0) { min--; if (robotbyte[tempp.X, min]!=0) { min = min + 1; break; } } while(max 0) { fp = new Point(fj, fi); if (dealroundpoint(fp, out sp)) { steps.Add(new Step(fp, sp)); robotbyte[fp.X, fp.Y] = 0; robotbyte[sp.X, sp.Y] = 0; stepmark++; } } } } while (stepmark< this.bushu) { int tempstepmark = stepmark; for (int fi = 0; fi < robotheight; fi++) { for (int fj = 0; fj < robotwidth; fj++) { if (this.GetValueByPos(new Point(fj, fi)) > 0) { fp = new Point(fj, fi); if(this.dealroundpointE(fp,out sp)) { steps.Add(new Step(fp, sp)); robotbyte[fp.X, fp.Y] = 0; robotbyte[sp.X, sp.Y] = 0; stepmark++; continue; } List sps = GetSecondByOnePos(fp); foreach (var temp in sps) { if (dealtwopoint(fp, temp)) { steps.Add(new Step(fp, temp)); robotbyte[fp.X, fp.Y] = 0; robotbyte[temp.X, temp.Y] = 0; stepmark++; break; } } } } } if (tempstepmark == stepmark) { break; } } } private List GetSecondByOnePos(Point fp) { List sp = new List(); for (int sj = 0; sj < robotheight; sj++) { for (int si = 0; si < robotwidth; si++) { if (this.robotbyte[fp.X, fp.Y] == this.robotbyte[si, sj]) { if (fp.X != si||fp.Y != sj) { sp.Add(new Point(si,sj )); } } } } return sp; } public class Step { public Point fp; public Point sp; public Step(Point fp,Point sp) { this.fp = fp; this.sp = sp; } } }
【文件预览】:
wg
----wgcommonclass.cs(73B)
----wg.sln(2KB)
----wg01()
--------Form1.cs(24KB)
--------Program.cs(485B)
--------Form1.resx(6KB)
--------Properties()
--------wg01.csproj(4KB)
--------Form1.Designer.cs(10KB)
--------obj()
--------bin()
----wg.suo(34KB)
----testsendmessage()
--------testsendmessage.csproj.user(452B)
--------Form1.cs(976B)
--------Program.cs(496B)
--------Form1.resx(6KB)
--------Properties()
--------testsendmessage.csproj(5KB)
--------Form1.Designer.cs(4KB)
--------obj()
--------bin()

网友评论

  • 可以参考一下