You are given 9 square pieces (A - I), each one having in each side a number from 1 to 4, positive or negative, as shown:
+------------+ +------------+ +------------+
| +1 | | +2 | | +1 |
| | | | | |
|-3 (A) +4| |+3 (B) -1| |+3 (C) -2|
| | | | | |
| -2 | | -4 | | -4 |
+------------+ +------------+ +------------+
+------------+ +------------+ +------------+
| -1 | | -2 | | +2 |
| | | | | |
|+2 (D) -4| |-4 (E) +1| |+1 (F) -3|
| | | | | |
| +1 | | +3 | | -4 |
+------------+ +------------+ +------------+
+------------+ +------------+ +------------+
| +3 | | -3 | | +3 |
| | | | | |
|-2 (G) +4| |+2 (H) -4| |-2 (I) +4|
| | | | | |
| -1 | | +1 | | -3 |
+------------+ +------------+ +------------+
Your task is to juxtapose them forming a 3x3 grid so that "touching numbers" of each pair of touching pieces (horizontally or vertically) adds to zero.
Note: You are free to rotate the pieces.
(In reply to
re(2): For those who wanna try... random sampling ... computer used by pcbouhid)
You'd get 288 solutions, or 576 counting reversals:
-4(B) 2-2(C) 3-3(A) 4-4(F) 2-2(I) 4-4(E) 1-1(D) 1-1(G) 3-3(H) 1
-4(B) 2-2(C) 3-3(A) 4-4(F) 2-2(I) 4-4(E) 1-1(G) 3-3(H) 1-1(D) 1
-4(B) 2-2(C) 3-3(A) 4-4(H) 2-2(I) 4-4(E) 1-1(D) 1-1(G) 3-3(F) 1
-4(B) 2-2(C) 3-3(A) 4-4(H) 2-2(I) 4-4(E) 1-1(G) 3-3(F) 1-1(D) 1
-4(B) 2-2(C) 3-3(F) 1-1(D) 1-1(G) 3-3(A) 4-4(H) 2-2(I) 4-4(E) 1
-4(B) 2-2(C) 3-3(F) 1-1(G) 3-3(A) 4-4(H) 2-2(I) 4-4(E) 1-1(D) 1
-4(B) 2-2(C) 3-3(H) 1-1(D) 1-1(G) 3-3(A) 4-4(F) 2-2(I) 4-4(E) 1
-4(B) 2-2(C) 3-3(H) 1-1(G) 3-3(A) 4-4(F) 2-2(I) 4-4(E) 1-1(D) 1
-4(B) 2-2(E) 3-3(A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 1-1(D) 1-1(B) 3-3(I) 3
-4(H) 2-2(E) 3-3(A) 4-4(F) 2-2(G) 4-4(C) 1-1(D) 1-1(B) 3-3(I) 3
-4(H) 2-2(G) 4-4(C) 1-1(D) 1-1(B) 3-3(A) 4-4(F) 2-2(E) 3-3(I) 3
-4(H) 2-2(G) 4-4(E) 1-1(D) 1-1(B) 3-3(A) 4-4(F) 2-2(C) 3-3(I) 3
-4(H) 2-2(G) 4-4(F) 2-2(C) 3-3(A) 4-4(E) 1-1(D) 1-1(B) 3-3(I) 3
-4(H) 2-2(G) 4-4(F) 2-2(E) 3-3(A) 4-4(C) 1-1(D) 1-1(B) 3-3(I) 3
The program:
DECLARE SUB addOn ()
DATA 1,4,-2,-3, 2,-1,-4,3, 1,-2,-4,3
DATA -1,-4,1,2, -2,1,3,-4, 2,-3,-4,1
DATA 3,4,-1,-2, -3,-4,1,2, 3,4,-3,-2
CLEAR , , 5000
DIM SHARED pc(9, 4), used(9), board(30), soFar, solCt, nUsed(4)
CLS
OPEN "9sqpces2.txt" FOR OUTPUT AS #2
FOR i = 1 TO 9
FOR j = 1 TO 4
READ pc(i, j)
NEXT
NEXT
soFar = 0
addOn
PRINT solCt
END
SUB addOn
FOR p = 1 TO 9
IF used(p) = 0 THEN
used(p) = 1
FOR rot = 1 TO 4
lft = pc(p, rot)
rgt = pc(p, (rot + 1) MOD 4 + 1)
IF soFar = 0 THEN
good = 1
ELSE
IF lft = -board(soFar * 3) THEN
good = 1
ELSE
good = 0
END IF
END IF
IF good THEN
IF soFar > 0 THEN
nUsed(ABS(lft)) = nUsed(ABS(lft)) + 1
END IF
IF nUsed(ABS(lft)) < 3 THEN
soFar = soFar + 1
board(soFar * 3 - 2) = lft
board(soFar * 3 - 1) = p
board(soFar * 3) = rgt
IF soFar = 9 THEN
IF board(9 * 3 - 1) > board(2) THEN
solCt = solCt + 1
IF RND(1) <= 1 THEN
FOR i = 1 TO soFar
PRINT STR$(board(3 * i - 2)); "("; MID$("ABCDEFGHI", board(3 * i - 1), 1); ")"; STR$(board(3 * i));
PRINT #2, STR$(board(3 * i - 2)); "("; MID$("ABCDEFGHI", board(3 * i - 1), 1); ")"; STR$(board(3 * i));
NEXT
PRINT
PRINT #2,
END IF
END IF
ELSE
addOn
END IF
soFar = soFar - 1
END IF
IF soFar > 0 THEN
nUsed(ABS(lft)) = nUsed(ABS(lft)) - 1
END IF
END IF
NEXT rot
used(p) = 0
END IF
NEXT
END SUB
|
Posted by Charlie
on 2005-12-12 16:17:23 |