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.
The following program is a modification to refer to the configuration of the second pentomino in the puzzle. It finds no solution. Either there is no solution for that pentomino, or there's a flaw in the program:
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 - 2 * v
FOR c = 1 TO 2 + 2 * v
IF pc = 1 THEN PRINT o, r, c
orc = 100 * o + 10 * r + c
IF orc >= chkProg(pc - 1) THEN
good = 1
FOR r2 = r TO r + 1 + 2 * v
FOR c2 = c TO c + 3 - 2 * v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 2 THEN chk = 0
IF o = 0 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 0 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r + 2 AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 3 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 3 AND c2 = c + 1 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 + 2 * v
FOR c2 = c TO c + 3 - 2 * v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 2 THEN chk = 0
IF o = 0 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 0 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r + 2 AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 3 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 3 AND c2 = c + 1 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 + 2 * v
FOR c2 = c TO c + 3 - 2 * v
chk = 1
IF o = 0 AND r2 = r AND c2 = c + 2 THEN chk = 0
IF o = 0 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 0 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r AND c2 = c THEN chk = 0
IF o = 1 AND r2 = r + 2 AND c2 = c + 1 THEN chk = 0
IF o = 1 AND r2 = r + 3 AND c2 = c + 1 THEN chk = 0
IF o = 2 AND r2 = r AND c2 = c + 3 THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 2 AND r2 = r + 1 AND c2 = c + 1 THEN chk = 0
IF o = 3 AND r2 = r AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 1 AND c2 = c THEN chk = 0
IF o = 3 AND r2 = r + 3 AND c2 = c + 1 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:51:53 |