The two pentominos pictured below cannot tile any rectangle.
+--+ +--+ +--+--+
| | | | | | |
+--+--+--+ +--+--+--+--+
| | | | | | | |
+--+--+--+ +--+--+--+
Take eight copies of one pentomino and place them on a 4x5 rectangle such that each 1x1 subsquare of the rectangle has
exactly two pentominos covering it.
In the following table, each row represents one of the eight pieces. The row and column are for the upper-leftmost position occupied by the piece, and the orientation is 0 for the same orientation as shown in the puzzle, 1 for rotated clockwise 90°, 2 for rotated 180°, and 3 for rotated clockwise 270°.
Assume the 4x5 grid is 4 rows high and 5 columns wide.
upper-left
corner
row column orientation
3 1 0
3 3 0
1 4 1
2 4 1
1 1 2
1 3 2
1 1 3
2 1 3
Description:
Assume the 4x5 grid is 4 rows high and 5 columns wide.
Two upside down U's are placed in the top two rows, overlapping in the middle column. Similarly, two right-side-up U's are placed in the bottom two rows, also overlapping in the middle column. Two U's with their tops to the left are placed in the left two columns, placed so that one arm of each U fills the empty spot left in the middle of the other U. Similarly on the right, the tops face outward (to the right) and are placed the same way, symmetrically with the left two.
DECLARE SUB place (pc!)
CLEAR , , 25000
DIM SHARED bd(4, 5)
DIM SHARED row(8), col(8), orient(8), chkProg(8)
'orient: 0 = top up; 1 = top to right; 2 = top down; 3 = top to left
CLS
place 1
SUB place (pc)
FOR o = 0 TO 3
v = o MOD 2
FOR r = 1 TO 3 - v
FOR c = 1 TO 3 + v
IF pc = 1 THEN PRINT o, r, c
orc = 100 * o + 10 * r + c
IF bd(r, c) < 2 AND orc >= chkProg(pc - 1) THEN
good = 1
FOR r2 = r TO r + 1 + v
FOR c2 = c TO c + 2 - v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF chk THEN
IF bd(r2, c2) > 1 THEN good = 0
END IF
NEXT
NEXT
IF good THEN
FOR r2 = r TO r + 1 + v
FOR c2 = c TO c + 2 - v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF chk THEN
bd(r2, c2) = bd(r2, c2) + 1
END IF
NEXT
NEXT
row(pc) = r: col(pc) = c: orient(pc) = o
chkProg(pc) = orc
IF pc < 8 THEN
place pc + 1
ELSE
FOR i = 1 TO 8
PRINT row(i); col(i); orient(i)
NEXT
PRINT
DO: LOOP UNTIL INKEY$ > ""
END IF
FOR r2 = r TO r + 1 + v
FOR c2 = c TO c + 2 - v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF chk THEN
bd(r2, c2) = bd(r2, c2) - 1
END IF
NEXT
NEXT
END IF
END IF
NEXT
NEXT r
NEXT o
END SUB
|
Posted by Charlie
on 2009-09-29 13:03:04 |