Ejemplo n.º 1
0
        public void PopulateWhiteNodes()
        {
            /* POPULATEWHITENODES FILLS EACH INDEX OF THE NODEARRAY WITH A PROPER
             * NODE OF A CORRESPONDING COLOUR */

            for (int i = 0; i < Math.Sqrt(nodeArray.Length); ++i)
            {
                for (int j = 0; j < Math.Sqrt(nodeArray.Length); ++j)
                {
                    if (i % 2 == 0 && j % 2 != 0)
                    {
                        nodeArray[i, j] = new Node("white");
                    }
                    else if (i % 2 != 0 && j % 2 == 0)
                    {
                        nodeArray[i, j] = new Node("white");
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public Node(string squareColour, Node piece)
 {
     colour = squareColour;
     currentPiece = piece;
 }
Ejemplo n.º 3
0
 public void PopulateBlackNodes()
 {
     /* POPULATEBLACKNODES IS THE SAME AS POPULATEWHITENODES, BUT FOR BLACK SQUARES */
     for (int i = 0; i < Math.Sqrt(nodeArray.Length); ++i)
     {
         for (int j = 0; j < Math.Sqrt(nodeArray.Length); ++j)
         {
             if (i % 2 == 0 && j % 2 == 0)
             {
                 nodeArray[i, j] = new Node("black");
             }
             else if (i % 2 != 0 && j % 2 != 0)
             {
                 nodeArray[i, j] = new Node("black");
             }
         }
     }
 }