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

 WXYZ (Posted on 2007-08-27)
The letters W, X, Y and Z are to appear twice in every row and column and once in every 2x2 box.

From the given starters, can you finish the puzzle?

 X W W W Y Y Z X X W Z W W Z Y Y X W Y X

 See The Solution Submitted by Josie Faulkner Rating: 4.2222 (9 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 2 of 5 |
`x y |z x |w z |w y |z w |y w |x y |z x |----+----+----+----+w z |y w |y x |x z |y x |x z |z w |y w |----+----+----+----+z y |w x |w x |y z |x w |z y |y z |w x |----+----+----+----+w z |x y |x w |z y |y x |w z |z y |x w |----+----+----+----+`

DECLARE SUB place (row!, col!)
CLEAR , , 9999
DIM SHARED g\$(8, 8)
DIM SHARED wcolct(8)
DIM SHARED xcolct(8)
DIM SHARED ycolct(8)
DIM SHARED zcolct(8)
DIM SHARED wrowct(8)
DIM SHARED xrowct(8)
DIM SHARED yrowct(8)
DIM SHARED zrowct(8)

g\$(1, 1) = "x"
g\$(2, 2) = "w"
g\$(1, 5) = "w"
g\$(1, 7) = "w"
g\$(2, 3) = "y"
g\$(2, 6) = "y"
g\$(3, 8) = "z"
g\$(4, 2) = "x"
g\$(4, 3) = "x"
g\$(4, 6) = "w"
g\$(5, 1) = "z"
g\$(5, 3) = "w"
g\$(5, 5) = "w"
g\$(5, 8) = "z"
g\$(6, 4) = "y"
g\$(7, 8) = "y"
g\$(8, 2) = "x"
g\$(8, 3) = "w"
g\$(8, 6) = "y"
g\$(8, 7) = "x"

xcolct(1) = 1: zcolct(1) = 1
xcolct(2) = 2: wcolct(2) = 1
xcolct(3) = 1: wcolct(3) = 2: ycolct(3) = 1
ycolct(4) = 1
wcolct(5) = 2
ycolct(6) = 2: wcolct(6) = 1
xcolct(7) = 1: wcolct(7) = 1
zcolct(8) = 2: ycolct(8) = 1

xrowct(1) = 1: wrowct(1) = 2
yrowct(2) = 2: wrowct(2) = 1
zrowct(3) = 1
xrowct(4) = 2: wrowct(4) = 1
zrowct(5) = 2: wrowct(5) = 2
yrowct(6) = 1
yrowct(7) = 1
yrowct(8) = 1: wrowct(8) = 1: xrowct(8) = 2

place 1, 2

SUB place (row, col)
'GOSUB report

IF g\$(row, col) > "" THEN
GOSUB nextone
EXIT SUB
END IF
r0 = INT((row + 1) / 2) * 2 - 1: c0 = INT((col + 1) / 2) * 2 - 1

IF wrowct(row) < 2 AND wcolct(col) < 2 THEN
good = 1
FOR r = r0 TO r0 + 1
FOR c = c0 TO c0 + 1
IF g\$(r, c) = "w" THEN good = 0: EXIT FOR
NEXT
IF good = 0 THEN EXIT FOR
NEXT
IF good THEN
g\$(row, col) = "w"
wrowct(row) = wrowct(row) + 1
wcolct(col) = wcolct(col) + 1

IF row = 8 AND col = 8 THEN
GOSUB report
ELSE
GOSUB nextone
END IF

g\$(row, col) = ""
wrowct(row) = wrowct(row) - 1
wcolct(col) = wcolct(col) - 1
END IF
END IF

IF xrowct(row) < 2 AND xcolct(col) < 2 THEN
good = 1
FOR r = r0 TO r0 + 1
FOR c = c0 TO c0 + 1
IF g\$(r, c) = "x" THEN good = 0: EXIT FOR
NEXT
IF good = 0 THEN EXIT FOR
NEXT
IF good THEN
g\$(row, col) = "x"
xrowct(row) = xrowct(row) + 1
xcolct(col) = xcolct(col) + 1

IF row = 8 AND col = 8 THEN
GOSUB report
ELSE
GOSUB nextone
END IF

g\$(row, col) = ""
xrowct(row) = xrowct(row) - 1
xcolct(col) = xcolct(col) - 1
END IF
END IF

IF yrowct(row) < 2 AND ycolct(col) < 2 THEN
good = 1
FOR r = r0 TO r0 + 1
FOR c = c0 TO c0 + 1
IF g\$(r, c) = "y" THEN good = 0: EXIT FOR
NEXT
IF good = 0 THEN EXIT FOR
NEXT
IF good THEN
g\$(row, col) = "y"
yrowct(row) = yrowct(row) + 1
ycolct(col) = ycolct(col) + 1

IF row = 8 AND col = 8 THEN
GOSUB report
ELSE
GOSUB nextone
END IF

g\$(row, col) = ""
yrowct(row) = yrowct(row) - 1
ycolct(col) = ycolct(col) - 1
END IF
END IF

IF zrowct(row) < 2 AND zcolct(col) < 2 THEN
good = 1
FOR r = r0 TO r0 + 1
FOR c = c0 TO c0 + 1
IF g\$(r, c) = "z" THEN good = 0: EXIT FOR
NEXT
IF good = 0 THEN EXIT FOR
NEXT
IF good THEN
g\$(row, col) = "z"
zrowct(row) = zrowct(row) + 1
zcolct(col) = zcolct(col) + 1

IF row = 8 AND col = 8 THEN
GOSUB report
ELSE
GOSUB nextone
END IF

g\$(row, col) = ""
zrowct(row) = zrowct(row) - 1
zcolct(col) = zcolct(col) - 1
END IF
END IF

EXIT SUB

nextone:
c = col + 1: r = row
IF c > 8 THEN r = r + 1: c = 1
place r, c
RETURN

report:
FOR r = 1 TO 8
FOR c = 1 TO 8
IF g\$(r, c) > "" THEN
PRINT g\$(r, c); " ";
ELSE
PRINT ". ";
END IF
IF c MOD 2 = 0 THEN PRINT "|";
NEXT
PRINT
IF r MOD 2 = 0 THEN PRINT "----+----+----+----+"
NEXT
PRINT
RETURN
END SUB

 Posted by Charlie on 2007-08-27 12:21:52

 Search: Search body:
Forums (5)