コード例 #1
0
    public void AddCellRecursive(MyCell c)
    {
        this.MyCellList.Add(c);

        var r = c.RightNeighbour;
        var b = c.BelowNeighbour;

        MyPath second = null;

        if (b == null && r == null)
        {
            return;        //end
        }
        else if (r == null)
        {
            second = this;
        }
        else
        {
            second = this.Clone();
            this.myGrid.MyPathList.Add(second);
            this.AddCellRecursive(r);
        }

        if (b == null)
        {
            this.myGrid.MyPathList.Remove(second);
        }
        else
        {
            second.AddCellRecursive(b);
        }
    }
コード例 #2
0
    public int FindPaths()
    {
        this.MyPathList.Clear();

        var p = new MyPath(this);

        this.MyPathList.Add(p);

        var c = new MyCell(this, 0, 0);

        p.AddCellRecursive(c);

        return(MyPathList.Count);
    }