Given partial information about a jigsaw puzzle, add the missing pieces.
If the information is insufficient to complete the details, or if given parts are in contradiction, the user should be notified.
The full information about the jigsaw puzzle contains the following parts:
pieces: Total number of piecesborder: Number of border piecesinside: Number of inside (non-border) piecesrows: Number of rowscolumns: Number of columnsaspectRatio: Aspect ratio of columns to rowsformat: Puzzle format, which can be portrait, square, or landscapeFor this exercise, you may assume square pieces, so that the format can be derived from the aspect ratio:
portraitsquarelandscapeA portrait jigsaw puzzle with 6 pieces, all of which are border pieces and none are inside pieces. It has 2 columns and 3 rows. The aspect ratio is 0.666666... (2/3).
A square jigsaw puzzle with 9 pieces, all of which are border pieces except for the one in the center, which is an inside piece. It has 3 columns and 3 rows. The aspect ratio is 1.0 (3/3).
A landscape jigsaw puzzle with 12 pieces, 10 of which are border pieces and 2 are inside pieces. It has 4 columns and 3 rows. The aspect ratio is 1.333333... (4/3).
Given partial information about a jigsaw puzzle, add the missing pieces.
If the information is insufficient to complete the details, or if given parts are in contradiction, the user should be notified.
The full information about the jigsaw puzzle contains the following parts:
pieces: Total number of piecesborder: Number of border piecesinside: Number of inside (non-border) piecesrows: Number of rowscolumns: Number of columnsaspectRatio: Aspect ratio of columns to rowsformat: Puzzle format, which can be portrait, square, or landscapeFor this exercise, you may assume square pieces, so that the format can be derived from the aspect ratio:
portraitsquarelandscapeA portrait jigsaw puzzle with 6 pieces, all of which are border pieces and none are inside pieces. It has 2 columns and 3 rows. The aspect ratio is 0.666666... (2/3).
A square jigsaw puzzle with 9 pieces, all of which are border pieces except for the one in the center, which is an inside piece. It has 3 columns and 3 rows. The aspect ratio is 1.0 (3/3).
A landscape jigsaw puzzle with 12 pieces, 10 of which are border pieces and 2 are inside pieces. It has 4 columns and 3 rows. The aspect ratio is 1.333333... (4/3).