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"); } } } }
public Node(string squareColour, Node piece) { colour = squareColour; currentPiece = piece; }
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"); } } } }