How wooden puzzles can destroy dev teams

I was pretty tired when I wrote that up, so here we go.

So we have piece 0, 1, 2, 3 and a hole; from now on p0-p3 and h respectively.

A solution consists of 16 unknown values:

  • x0 : the horizontal orientation of p0
  • y0 : the vertical orientation of p0
  • r0 : the 0->2pi rotation of p0
  • f0 : a -1 or +1 value of the flip/mirroring of p0
  • x1, x2, x3, y1,y2, y3, r1, r2, r3, f1, f2, f3 etc, with these values for each piece.

In order to solve this problem, we need to solve these 16 values in one set where the implied rules of the puzzle are not broken, we'll go over those soon.

So since this puzzle is made up of pieces which are easily decomposed into regular, uniform sized triangles, the units from now on will be 1 triangle edge length. A triangle is therefore rad(3)/2 tall, if it is 1 wide.

So now we'll create a vertex matrix for each piece. To do that, we have to find an orientation of the piece that makes math a bit easier (I rotated p0 180*). Using the units above, we'll create a matrix with 4 rows and a column for each corner. The rows are defined as such:

  • x
  • y
  • next x
  • next y

where the x and y values are values relative to the origin corner. This will create a matrix where each row is a vertex or edge of the polygon

So we're creating a vertex matrix. Here's the first row visualized

So p0 will be described as the matrix:

0 1 2 1 3/2 1 1/2 1 1/2 -1/2
0 0 rad(3) 2rad(3) 5rad(3)/2 3rad(3) 2rad(3) rad(3) rad(3)/2 rad(3)/2
1 2 1 3/2 1 1/2 1 1/2 -1/2 0
0 rad(3) 2rad(3) 5rad(3)/2 3rad(3) 2rad(3) rad(3) rad(3)/2 rad(3)/2 0

Give me some time to make the vertex matrixes for the other pieces, I'll either respond to this or edit it. I'm at work now and stretching my memory of linear algebra -- I might need to get out my old text book

/r/programming Thread Parent Link - engineering.khanacademy.org