All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 ABCD (2) (Posted on 2008-03-07)
Place one of the four letters A, B, C or D in each of the blue-coloured cells. No letter can be horizontally or vertically adjacent to itself. The yellow-coloured tables above and to the left of the grid indicate how many times each letter appears in that column or row.

This is an extended version of ABCD.

 A 3 2 0 2 2 2 0 3 1 B 2 1 3 0 0 1 3 0 2 C 1 2 1 3 2 3 1 2 1 A B C D 0 1 2 1 2 0 2 1 2 2 0 4 3 4 4 1 0 3 2 2 2 3 3 2 1 1 0 4 4 2 3 3 1

 No Solution Yet Submitted by Josie Faulkner Rating: 4.1667 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution (spoiler) | Comment 2 of 20 |

A little tweak of my computer solution to the first ABCD, by increasing the length of each of the 6 strings, was sufficient to solve this one:

DECLARE SUB permute (a\$)
DECLARE FUNCTION noColExcd! (s\$)
DECLARE SUB subtOut (s\$)
DIM SHARED aMax(9), aCt(9)
DIM SHARED bMax(9), bCt(9)
DIM SHARED cMax(9), cCt(9)
DIM SHARED dMax(9), dCt(9)

DATA 3,2,0,2,2,2,0,3,1
DATA 2,1,3,0,0,1,3,0,2
DATA 1,2,1,3,2,3,1,2,1
DATA 0,1,2,1,2,0,2,1,2

CLS

FOR i = 1 TO 9: READ aMax(i): NEXT
FOR i = 1 TO 9: READ bMax(i): NEXT
FOR i = 1 TO 9: READ cMax(i): NEXT
FOR i = 1 TO 9: READ dMax(i): NEXT

s1\$ = "aaccccddd": h1\$ = s1\$
DO
IF noColExcd(s1\$) THEN

s2\$ = "aaaabbbbc": h2\$ = s2\$
DO
IF noColExcd(s2\$) THEN

s3\$ = "aaabbccdd": h3\$ = s3\$
DO
IF noColExcd(s3\$) THEN

s4\$ = "aaabbbccd": h4\$ = s4\$
DO
IF noColExcd(s4\$) THEN

s5\$ = "accccdddd": h5\$ = s5\$
DO
IF noColExcd(s5\$) THEN

s6\$ = "aabbbcccd": h6\$ = s6\$
DO
IF noColExcd(s6\$) THEN

col = solCt MOD 10
row = solCt \ 10
col = col * 8 + 1
row = row * 8 + 1
LOCATE row, col: PRINT s1\$
LOCATE row + 1, col: PRINT s2\$
LOCATE row + 2, col: PRINT s3\$
LOCATE row + 3, col: PRINT s4\$
LOCATE row + 4, col: PRINT s5\$
LOCATE row + 5, col: PRINT s6\$
solCt = solCt + 1

subtOut s6\$
END IF
END IF
END IF
permute s6\$
LOOP UNTIL s6\$ = h6\$

subtOut s5\$
END IF
END IF
END IF
permute s5\$
LOOP UNTIL s5\$ = h5\$

subtOut s4\$
END IF
END IF
END IF
permute s4\$
LOOP UNTIL s4\$ = h4\$

subtOut s3\$
END IF
END IF
END IF
permute s3\$
LOOP UNTIL s3\$ = h3\$

subtOut s2\$
END IF
END IF
END IF
permute s2\$
LOOP UNTIL s2\$ = h2\$

subtOut s1\$
END IF
END IF
permute s1\$
LOOP UNTIL s1\$ = h1\$

PRINT : PRINT solCt

FOR i = 1 TO LEN(s\$)
SELECT CASE MID\$(s\$, i, 1)
CASE "a"
aCt(i) = aCt(i) + 1
CASE "b"
bCt(i) = bCt(i) + 1
CASE "c"
cCt(i) = cCt(i) + 1
CASE "d"
dCt(i) = dCt(i) + 1
END SELECT
NEXT
END SUB

FUNCTION noColExcd (s\$)
good = 1
FOR i = 1 TO LEN(s\$)
x\$ = MID\$(s\$, i, 1)
SELECT CASE x\$
CASE "a"
IF aCt(i) = aMax(i) THEN good = 0: EXIT FOR
CASE "b"
IF bCt(i) = bMax(i) THEN good = 0: EXIT FOR
CASE "c"
IF cCt(i) = cMax(i) THEN good = 0: EXIT FOR
CASE "d"
IF dCt(i) = dMax(i) THEN good = 0: EXIT FOR
END SELECT
NEXT
noColExcd = good
END FUNCTION

good = 1
FOR i = 1 TO LEN(s\$) - 1
IF MID\$(s\$, i, 1) = MID\$(s\$, i + 1, 1) THEN good = 0: EXIT FOR
NEXT
END FUNCTION

good = 1
FOR i = 1 TO LEN(a\$)
IF MID\$(a\$, i, 1) = MID\$(b\$, i, 1) THEN good = 0: EXIT FOR
NEXT
END FUNCTION

END SUB

DEFSNG A-Z
SUB subtOut (s\$)
FOR i = 1 TO LEN(s\$)
SELECT CASE MID\$(s\$, i, 1)
CASE "a"
aCt(i) = aCt(i) - 1
CASE "b"
bCt(i) = bCt(i) - 1
CASE "c"
cCt(i) = cCt(i) - 1
CASE "d"
dCt(i) = dCt(i) - 1
END SELECT
NEXT
END SUB

producing

`acdcacdcdbabacabababdcabcdababadcbaccdcdcadcdacbcdcbab`

 Posted by Charlie on 2008-03-07 12:52:02

 Search: Search body:
Forums (0)