# Create the freest arrangement of white chess pieces on board by consequently moving your pieces

You start with this board. You're the White. Freedom Index of initial arrangment of your chess pieces is equal to 20 (each pawn has two moves, each knight has two moves)

I will select answer with the highest Freedom Index, compared to other answers.

• Are you aware of an upper bound or maximal answer to this puzzle? – bobble Oct 3 '20 at 16:40
• @bobble Yes, upper bound. Suppose we promoted each pawn to queen. Let's also suppose that each chess piece will get maximum possible freedom of movement that it can get in chess at all, not accounting how we can achieve it while having other pieces on the board (i.e. as if it was placed in the center of empty board). 9*27+1*8+2*14+2*13+2*8=321. It can't get higher than that, but this is likely an overestimate. – user161005 Oct 3 '20 at 16:53
• "..as long as computer keeps history of its moves" seems like a bizarre limitation. Since we are promoting all the pawns anyway, and there's no limit on how many moves we can make, any position with a plausible piece composition (16 pieces including one king, at least one bishop on a dark square, etc) is reachable. – Bass Oct 3 '20 at 18:05
• @Bass Okay, I dropped this requirement – user161005 Oct 4 '20 at 2:41

222: $$\begin{matrix}R_{11} & . & . & . & . & . & . & R_{10} \\. & K_7 & . & . & . & Q_{18} & . & . \\. & . & . & Q_{24} & . & . & . & . \\. & Q_{18} & . & . & . & . & Q_{20} & . \\. & . & . & . & Q_{24} & . & . & . \\. & . & Q_{21} & . & . & . & . & Q_{16} \\Q_{15} & . & . & . & . & Q_{18} & . & . \\. & . & B_5 & B_7 & N_4 & N_4 & . & . \\\end{matrix}$$
I used integer linear programming as follows. Let $$P$$ be the set of pieces, with number $$n_p$$ of pieces available: $$n_\text{king}=1, n_\text{bishop}=n_\text{knight}=n_\text{rook}=2, n_\text{queen}=9$$. Let $$C=\{1,\dots,8\}^2$$ be the set of cells. For each piece $$p\in P$$ and cell $$(i,j)\in C$$, let $$N_{p,i,j} \subseteq C$$ be the set of neighboring cells with respect to possible moves of $$p$$. For $$p\in P$$, $$(i,j)\in C$$, and $$(i_2,j_2)\in N_{p,i,j}$$, let $$B_{p,i,j,i_2,j_2} \subseteq C$$ be the set of cells strictly between $$(i,j)$$ and $$(i_2,j_2)$$. Let binary decision variable $$x_{p,i,j}$$ indicate whether piece $$p$$ occupies cell $$(i,j)$$. Let binary decision variable $$m_{p,i,j,i_2,j_2}$$ indicate whether piece $$p$$ occupies cell $$(i,j)$$ and can move to cell $$(i_2,j_2)$$. The problem is to maximize $$\sum_{p\in P} \sum_{(i,j)\in C} \sum_{(i_2,j_2)\in N_{p,i,j}} m_{p,i,j,i_2,j_2}$$ subject to \begin{align} \sum_{p\in P} x_{p,i,j} &\le 1 &&\text{for (i,j)\in C} \tag1\\ \sum_{(i,j)\in C} x_{p,i,j} &\le n_p &&\text{for p\in P} \tag2\\ m_{p,i,j,i_2,j_2} &\le x_{p,i,j} &&\text{for p\in P, (i,j)\in C, (i_2,j_2)\in N_{p,i,j}} \tag3\\ m_{p,i,j,i_2,j_2} &\le 1-\sum_{p_2} x_{p_2,i_2,j_2} &&\text{for p\in P, (i,j)\in C, (i_2,j_2)\in N_{p,i,j}} \tag4\\ m_{p,i,j,i_2,j_2} &\le 1-\sum_{p_2} x_{p_2,i_3,j_3} &&\text{for p\in P, (i,j)\in C, (i_2,j_2)\in N_{p,i,j}, (i_3,j_3)\in B_{p,i,j,i_2,j_2}} \tag5 \\ \sum_{\substack{(i,j) \in C:\\ \mod(i+j,2) = r}} x_{\text{bishop},i,j} &\le 1 &&\text{for r \in \{0,1\}} \tag6 \end{align} Constraint $$(1)$$ places at most one piece per cell. Constraint $$(2)$$ places at most $$n_p$$ copies of piece $$p$$. Constraint $$(3)$$ enforces $$m_{p,i,j,i_2,j_2} = 1 \implies x_{p,i,j} = 1$$. Constraint $$(4)$$ enforces $$m_{p,i,j,i_2,j_2} = 1 \implies x_{p_2,i_2,j_2} = 0$$. Constraint $$(5)$$ enforces $$m_{p,i,j,i_2,j_2} = 1 \implies x_{p_2,i_3,j_3} = 0$$. Constraint $$(6)$$ enforces at most one bishop per color.