Beispiel #1
0
        void Explore(MoveSetElement startElement, int currentDistance, int maxDistance, PlayGrid grid)
        {
            currentDistance++;
            if (currentDistance > maxDistance)
            {
                return;
            }

            for (int i = -1; i <= 1; i++)
            {
                for (int j = -1; j <= 1; j++)
                {
                    GridSpot spot = grid.GetSpot(startElement.spot.CoordX + i, startElement.spot.CoordY + j, true);
                    if (spot != null)
                    {
                        MoveSetElement newOrUpdatedElement = TryAndAddOrUpdate(spot, startElement, currentDistance);
                        if (newOrUpdatedElement != null)
                        {
                            Explore(newOrUpdatedElement, currentDistance, maxDistance, grid);
                        }
                    }
                }
            }
        }