What's the maximal number of chess pieces under this rule? Suppose we have a $n\times n$ chessboard, where $n\geq 3$ is a positive integer. We place chess pieces on the board such that any three of them are not standing next to each other and on the same line (row or column). For example, when $n=3$ ($\times$ denotes a chess piece),
$$
\begin{matrix}
\times &\times &\\
&\times &\times\\
& &\times
\end{matrix}
$$
is valid, but
$$
\begin{matrix}
\times&\times&\\
&\times&\\
&\times&\times
\end{matrix}
$$
is invalid, because the second column does not meet the requirement.
What's the maximal number of chess pieces you can put onto the chessboard?
MY PROGRESS
I have found that if you put chess pieces on all positions on the diagonal, $1^\text{st}$ superdiagonal, $2^\text{nd}$ subdiagonal, $3^\text{rd}$ superdiagonal, $4^\text{th}$ subdiagonal, ... , then any extra chess piece makes it invalid. However, I cannot prove that this strategy of positioning leads to the maximal number of chess pieces.
 A: Answer: When $n\ge 3$, the largest number of pieces you can put on the board is
$$
\text{max # pieces}=\begin{cases}
2n^2/3 & n \equiv 0\pmod 3\\
(2n^2+1)/3 &  n\not\equiv 0\pmod 3
\end{cases}
$$
This also works for $n=1$, but for $n=2$, you can fit one more piece than the formula.
How to achieve this maximum: Suppose the squares are labeled by ordered pairs of positive integers, so that $(1,1)$ is the lower left corner and $(n,n)$ is the upper right. Define the $k^{th}$ diagonal to be the set of squares $(x,y)$ for which $x+y-1=k$. This means the $1^\text{st}$ diagonal is a single square $(1,1)$, the $n^\text{th}$ diagonal is the main diagonal with $n$ squares, and the $(2n-1)^\text{st}$ diagonal is a single square, $(n,n)$.
The strategy is to fill the board with pieces, and then remove pieces on the superdiagonal, and every third diagonal after and before it. That is, the set of diagonals with index $n+1+3i$, for all integers $i$ such that there is a diagonal with that index. Here is an example with $n=5$ attaining the optimum of $(2\times 5^2+1)/3=17$.
x . x x .
x x . x x 
. x x . x
x . x x .
x x . x x

Proof of optimality: First, suppose that $n$ is a multiple of $3$. In this case, the $n\times n$ board can be completely tiled with $1\times 3$ rectangles. The number of tiles is $n^2/3$. Each of these rectangles can contain at most two chess pieces (otherwise you would have three in a row), so you can have at most $2\times n^2/3$ pieces, as claimed.
When $n$ is not a multiple of $3$, you use the same strategy, except this time you tile all but one of the squares with $1\times 3$ and $3\times 1$ tiles. Each of the tiles can have at most two pieces, plus one additional piece on the uncovered square, which comes to $(2n^2+1)/3$.
If $n$ is one more than a multiple $3$, then the leftover tile is one of the corners, and the tiling is pretty easy to find. Here is an illustration when $n=7$:

If $n$ is two more than a multiple of $3$, then the uncovered tile will be at $(3,3)$. On the left is the case $n=5$. For general $n$ in the form $3k+2$, you can do the same strategy by placing the $n=5$ tiling in the lower left corner, and the rest can easily be tiled with $1\times 3$ and $3\times 1$. On the right is an illustration when $n=8$.

