SaintDron
on Oct. 1, 2018, 11:58 a.m.
<p>Strongly compressed and not clear. But as for such a non-trivial task, it is very short.</p>

vincent.tscherter
on Oct. 1, 2018, 12:39 p.m.
<p>This was version 7 oder 8, I think 🤔. At last I added some comments 😇.</p>
<p>First get the tree possible orientation - skipping the top an the bottom in the process - of each cubes. Let's call dem cube rings.</p>
<pre class='brush: javascript'>cubes = cubes.map ( c =&gt; ['0132', '4152', '0534'].map( x =&gt; [...x].map( x =&gt; c[+x]).join('')))
</pre>
<p>turns </p>
<pre class='brush: javascript'>["GYVABW","AOCGYV","CABVGO","OVYWGA"]
</pre>
<p>into </p>
<pre class='brush: javascript'>[["GYAV","BYWV","GWAB"],["AOGC","YOVC","AVGY"],["CAVB","GAOB","COVG"],["OVWY","GVAY","OAWG"]]
</pre>
<p>Then we calculate the max of the max of each cube. I didn't find a better way to label the vars in the cascade of loops than with a, b, c, d.</p>
<p>Most importantly how do we know if for instance the third cube <strong>CABVGO</strong> fits on the first orientation (ring) <strong>AOGC</strong> of the second cube <strong>AOCGYV</strong> used as base?</p>
<p>It fits, if some of the orientations (rings) <strong>["CAVB","GAOB","COVG"]</strong> of the third cube is included in <strong>AOGCAOGC CGOACGOA</strong>. Duplicate the ring and its reverse. This is done with</p>
<pre class='brush: javascript'>c =&gt; c.some( d =&gt; (b+b+' '+(b+b).rev()).includes(d) )
</pre>

SaintDron
on Oct. 1, 2018, 3:13 p.m.
<p>Thank you for the clarification. I understood absolutely everything.</p>

SaintDron
on Oct. 1, 2018, 3:15 p.m.
<p>It's a very good idea that any cube can be described in three 'strips'.</p>

vincent.tscherter
on Oct. 1, 2018, 12:47 p.m.
<p>Then we calculate the max of the max of each cube. I didn't find a better way to label the vars in the cascade of loops than with a, b, c, d. Most importantly how do we know if for instance the third cube fits <strong>CABVGO</strong> fits on the first orientation <strong>AOGC</strong> of the second cube <strong>AOCGYV</strong> used as base?</p>
<p>It fits, if some of the orientation <strong>["CAVB","GAOB","COVG"]</strong> of the third cube is included in <strong>AOGCAOGC CGOACGOA</strong>? This is done with</p>
<pre class='brush: javascript'>c =&gt; c.some( d =&gt; (b+b+' '+(b+b).rev()).includes(d) )
</pre>