I am working on an answer to the question
Magic trick based on deep mathematics
and came across the following problem: I am trying to partition the cube $\{0,1\}^n$ into $n$ sets $P_1,\dots,P_n$ such that, for any point $x\in\{0,1\}^n$ and any $i\in\{1,\dots,n\}$, there exists a point $y\in P_i$ such that $x$ and $y$ differ in at most one term. Using my computer I know that this is possible for $n\leq 4$, impossible for $n=5$ and $6$, and possible for $n=7$ and $8$ (by brute force integer programming). For example, one solution for $n=4$ is \begin{align*} P_{1} & =xyyy\text{ or }xxxx\\ P_{2} & =xyxx\text{ or }xyyx\\ P_{3} & =xxyx\text{ or }xyxy\\ P_{4} & =xxxy\text{ or }xxyy \end{align*} where $x$ and $y$ are separate values in $\{0,1\}$. My question is: can this partition (or something like it) extend to $n=8$ in a simple way? Alternatively, are there any values of $n$ for which there is a simple and natural partition?
To clarify my notation here is an explicit list of the $P_i$'s for $n=4$:
\begin{align*} P_{1} & =0111\text{ or }1000\text{ or }0000\text{ or }1111\\ P_{2} & =0100\text{ or }1011\text{ or }0110\text{ or }1001\\ P_{3} & =0010\text{ or }1101\text{ or }0101\text{ or }1010\\ P_{4} & =0001\text{ or }1110\text{ or }0011\text{ or }1100 \end{align*}