private bool Ydirect(Grid start, Grid end, LinkedList path) { if (start.GetXpos() != end.GetXpos()) { return false; } int direct = 1; if (start.GetYpos() > end.GetYpos()) { direct = -1; } path.Clear(); for (int y = start.GetYpos() + direct; y != end.GetYpos() && y < yBound && y >= 0; y += direct) { if (grid[y][start.GetXpos()].IsVisible()) { return false; } path.Add(grid[y][start.GetXpos()]); } path.Add(end); return true; }
private void DeletePair(Grid prev, Grid current) { LinkedList temp = new LinkedList(); temp.Add(prev); for (int i = 0; i < pcount; i++) { temp.AddAll(path[i]); path[i].Clear(); } AnimateThread thread = new AnimateThread(temp); thread.Tag = this; thread.Start(); }
private bool Xdirect(Grid start, Grid end, LinkedList path) { if (start.GetYpos() != end.GetYpos()) return false; int direct = 1; if (start.GetXpos() > end.GetXpos()) { direct = -1; } path.Clear(); for (int x = start.GetXpos() + direct; x != end.GetXpos() && x < xBound && x >= 0; x += direct) { if (grid[start.GetYpos()][x].IsVisible()) { return false; } path.Add(grid[start.GetYpos()][x]); } path.Add(end); return true; }