To page explains why the Solution by SQL solves the puzzle Color Coordination Puzzle
If you run the SQL here is what you will get:
blk_num | color_position | color_cd |
---|---|---|
2 | 0 | Y |
1 | 2 | R |
6 | 4 | W |
0 | 3 | G |
3 | 1 | X |
4 | 5 | B |
5 | 0 | Y |
What does this output mean?
The table CIRCLES has the following definition:
BLK_NUM is the Block Number or the Piece Number (corresponds to each cookie and ranges from 0 to 6) COLOR_POSITION ranges from 0 to 5 and is useful in determining the sequence of the dots on the cookie COLOR_CD is of course the color of the dot.
When we defined the table data each cookie was given a number from 0 to 6. This is the original number.
The result is the order in which you need to place the cookies (based on the original number). So you place cookie # 2, 1st and keep going clockwise, placing cookie #1 next and so on until you complete the circle. You place the last cookie (# 5) in the center.
The 2nd and 3rd values in the output help you rotate the placed cookies and align the dots. So rotate (or place cookie) # 1 so that Yellow is facing the center. Red dot faces center for cookie # 2 and so on.
Check out the picture below as well for the explanation of the solution above.