# [Wolfram Language (Mathematica)], 232 bytes n=6;c=Graphics[{#,Rotate[Polygon[CirclePoints@6],30Degree]}, ImageSize->9]&; Column[Row/@TakeList[(Mod[Tr@DigitCount[#,2,1],2]&/@Reverse@Select[Tuples[Range[0,2^n-1],3],Tr@#==2^n-1&])/. {1->c@Red,0->c@Yellow},Range[2^n]],Center,.01] I believe that this is NOT code-golf... If OP decides that it is, then I will golf it [![enter image description here][1]][1] [Wolfram Language (Mathematica)]: https://www.wolfram.com/wolframscript/ [1]: https://i.sstatic.net/TYtxJ.png