Пример #1
0
    public static void Main()
    {
        //https://docs.google.com/spreadsheets/d/1v90ZW65jDo-c3_5oWHT7UYIYtDB3ma44uUdaoYh8TeQ/
        String[,] grid = {
            {"_0", "_1", "_2", "_3"},
            {"_8", "_9", "_10", "_11"},
            {"_16", "_17", "_18", "_19"},
            {"_24", "_25", "_26", "_27"},
        };
        Console.WriteLine("Grid valid? " + gridValid(grid, 4, 4));

        InfoOfEachTile topLeft = new InfoOfEachTile("_9");
        InfoOfEachTile topRight = new InfoOfEachTile("_10");
        InfoOfEachTile bottomLeft = new InfoOfEachTile("_17");
        InfoOfEachTile bottomRight = new InfoOfEachTile("_18");
        InfoOfEachTile.connectHorizontal(topLeft, topRight);
        InfoOfEachTile.connectHorizontal(bottomLeft, bottomRight);
        InfoOfEachTile.connectVertical(topLeft, bottomLeft);
        InfoOfEachTile.connectVertical(topRight, bottomRight);

        String[,] miniGrid = miniGridFromTile(topLeft);
        for (var y = miniGrid.GetLowerBound(0); y <= miniGrid.GetUpperBound(0); y++)
        {
            for (var x = miniGrid.GetLowerBound(1); x <= miniGrid.GetUpperBound(1); x++)
            {
                Console.Write(miniGrid[y, x] == null ? "__ " : miniGrid[y, x] + " ");
            }
            Console.WriteLine();
        }
        Console.WriteLine("GRID VALID: " + validateTile(bottomRight));
    }
Пример #2
0
 public static void connectVertical(InfoOfEachTile up, InfoOfEachTile down)
 {
     if (up != null && down != null)
     {
         up.Down = down;
         down.Up = up;
     }
 }
Пример #3
0
 public static void connectHorizontal(InfoOfEachTile left, InfoOfEachTile right)
 {
     if (left != null && right != null)
     {
         left.Right = right;
         right.Left = left;
     }
 }