Code

initDomain[n_,d_]:=(
words=Tuples[{0,1},n];
distMat=Outer[HammingDistance,words,words,1];
g=AdjacencyGraph[Map[Boole[#==1]&,distMat,{2}]];
gg=GraphPower[g,d];
verts=FindIndependentVertexSet[gg];
code=words[[verts]]
);

initDomain[3,1];
code

initDomain[4,1];
code

initDomain[6,2];
code

(* best code is known to be 16 codewords *)
initDomain[7,3];
code

Pictures

pic1=Graphics3D[{FaceForm[Opacity[.5]],GraphicsComplex[{{-(1/2),-(1/2),-(1/2)},{-(1/2),-(1/2),(1/2)},{-(1/2),(1/2),-(1/2)},{-(1/2),(1/2),(1/2)},{(1/2),-(1/2),-(1/2)},{(1/2),-(1/2),(1/2)},{(1/2),(1/2),-(1/2)},{(1/2),(1/2),(1/2)}},{Polygon[{{8,4,2,6},{8,6,5,7},{8,7,3,4},{4,3,1,2},{1,3,7,5},{2,1,5,6}}],Opacity[1],Red,Sphere[3,.1],Sphere[2,.1],Sphere[5,.1],Sphere[8,.1]}]},Boxed->False]

is=320;
aa=4;
Export["~/Desktop/hamming3.png",Rasterize[pic1,ImageSize->is,RasterSize->aa*is]];

g=GraphData["TesseractGraph"];
initDomain[4,1];
g=GraphData["TesseractGraph"];
pic2=Show[HighlightGraph[g,FindIndependentVertexSet[g],VertexSize->Large,GraphHighlightStyle->"Thick"]];
rast2=Rasterize[pic2,ImageSize->is];
Row[{rast2,Rasterize[MatrixForm[code]]}]