public List <FindPatternResult> getPossibleMove() { List <String> hash = new List <String>(); List <FindPatternResult> ret = new List <FindPatternResult>(); for (int y = 0; y < NUMCELL; y++) { for (int x = 0; x < NUMCELL; x++) { foreach (CandyPattern p in lstPattern) { /* if ((y == 7) && (x == 0)) * { * Console.WriteLine(""); * }*/ if (isTableMatch(table, p, x, y)) { FindPatternResult f = new FindPatternResult(); f.from = new Point(x + p.target[0].X, y + p.target[0].Y); f.to = new Point(x + p.target[1].X, y + p.target[1].Y); if ((table[f.from.X, f.from.Y] != null) && (table[f.to.X, f.to.Y] != null)) { if (!hash.Contains(f.ToString())) { ret.Add(f); hash.Add(f.ToString()); } } } } } } return(ret); }
public void move(FindPatternResult f) { txtDebug.AppendText("Move " + f.ToString() + Environment.NewLine); lstHistory.Add(board); //flgDebug = true; board = board.process(f); flgDebug = false; currentBestMove = board.getBestMove(); lstResult = board.getPossibleMove(); imgMain.Refresh(); }