/// <summary> /// Place a <paramref name="player"/>'s symbol at a given position. /// </summary> /// <param name="x">X coordinate of the target position.</param> /// <param name="y">Y coordinate of the target position. </param> /// <param name="player">Player making this move.</param> /// <returns>True if legal move, false otherwise.</returns> public bool DoMove(int x, int y, int player) { if (Values[x][y] != 0) { return(false); } Values[x][y] = player; if (Values[x].All(v => v == player) || Values.All(a => a[y] == player) || (x == y || y == Size - 1 - x) && Diagonals.Any(diag => diag.All(val => val == player))) { Winner = player; } return(true); }