Note that there are some explanatory texts on larger screens.

plurals
  1. POShortest path with figures on board
    text
    copied!<p>I'm having trouble with my homework assignment(C++). I'm not asking for the complete solution, but tilt in the right direction could be helpful. :)</p> <p>I have a NxN board (max N = 100) and a 1x2 figure (cube) on that board. The cube is painted red on the one side and blue on the other. Default position for the cube is left upper angle of the board, blue side up:</p> <pre><code>B B . . . . . . . . . . . . . . </code></pre> <p>(4x4 example, B stands for blue)</p> <p><strong>There could be stones (obstacles) on the blackboard.</strong> Moves I can make with my figure:</p> <ul> <li>rotating it for 90/180/270 degrees clockwise</li> <li>you can flip the cube around its right/left/upper/lower edge, changing its ''upward color''</li> </ul> <p>For an example, using flip right on the default position:</p> <pre><code>. . R R . . . . . . . . . . . . </code></pre> <p>and then using rotate 90:</p> <pre><code>. . R . . . R . . . . . . . . . </code></pre> <p>and then using flip left:</p> <pre><code>. B . . . B . . . . . . . . . . </code></pre> <p>Of course, when rotating or flipping, you cannot land on the stone. So, the problem is - for any given configuration of the board (figure position and stone positions) write a program that will ''bring the cube home'' in the default position (blue side upwards!) <strong>using minimal number of moves</strong> and return 1 if that's possible or return 0 if that's impossible.</p> <p>I find this problem interesting, but I have to admit I'm slightly confused with it. Especially the blue side/red side part. I can't really figure out how to ''translate'' those moves I can use in the language of usual shortest path algorithms (and I never used any of these). So, I would be grateful for every piece of advice you can give! :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload