If you live in a 2-d neighborhood the "four color theorem" proves you only need four codes to not share a code with a neighbor, assuming perfect information.
The wikipedia article for the four color theorm discusses higher dimensional life like being in a 3-d apartment building. If you live in a Klein bottle you got other problems beyond ceiling fans.