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

Home > General > Word Problems
Double Word Square Challenge (Posted on 2011-10-07) Difficulty: 4 of 5
Try to create the largest (most letters used) Double Word Square where each letter in the square is distinct. All words used must be English words which are not strictly proper nouns (capitalized), interjections or slang. The words do not all need be common.

As more than one possibility can exist, score the word square of your submission as a sum of the values of each across word using the normal letter values of the English-language edition of Scrabble ® + 100*o, where o is the order of the word square*:
1 : A, E, I, L, N, O, R, S, T, U
2 : D, G
3 : B, C, M, P
4 : F, H, V, W, Y
5 : K
8 : J, X
10: Q, Z



* A word square of order 3 is a square 3x3, a word square of order 4 is a square 4x4, etc.

See The Solution Submitted by Dej Mar    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution 4x4 case using a computer program | Comment 1 of 2

I figured a 5x5 would be impossible due to an insufficient availability of vowels, and excruciatingly long in run time, and so kept it to 4x4's.  At that it took 7 or 8 hours to run, after debugging using 3x3's (not carried out to the end).

The scores to the right of each set are just the totals of the values of the letters used. I think the directions call for adding 400 to this as these are 4x4.

The largest score shown is 37, but I can't find "upby" in a legitimate dictionary.  I had used a word list from the internet.

The 34-pointer uses some obscure, but legitimate, words, with definitions shown here from the Random House unabridged dictionary:

chid = one form of the past tense of chide
wany = waning or decreasing; also descriptive of wood containing many defects
murk = darkness, gloom
sloe = the small, sour, blackish fruit of the blackthorn

cwms = cirques (i.e., circles or rings)
haul = pull, drag
inro = a small lacquer box with compartments for medicines, cosmetics, etc., worn on the waist sash of the traditional Japanese costume.
dyke = dike: an embankment for controlling or holding back the waters of the sea or a river

Note that capitalized words are not used below: particularly, "bach" is an informal term for bachelor, and not the proper name of the composer.

bach
ruly
item
gown           32
bach
ruly
item
sown           31
bash
ruly
item
gown           30
caph
ruly
item
sown           31
chid
wany
murk
sloe           34
chit
wany
murk
sloe           33
chow
ruby
agin
pets           32
chug
oily
frap
tens           30
fash
ruly
item
gown           31
flow
ruby
agin
pets           30
gash
ruly
item
down           29
glib
yuca
prow
send           30
grid
yuca
plow
sent           28
irks
tune
clag
hypo           31
irks
tuna
clod
hype           31
irks
tuna
clog
hype           31
kaph
ruly
item
sown           33
meow
upby
chin
kats           37
nags
ecru
whim
typo           32
pash
ruly
item
gown           30
slid
yuca
prof
hent           30
slid
yuca
prow
hent           30
tick
ogre
plan
hubs           30
tick
ogre
play
hubs           33
tick
ogre
plan
hums           30
tick
ogre
play
hums           33
tidy
ogre
plan
hubs           28
tidy
ogre
plan
hums           28


The program is written to handle only 3x3 or 4x4, by changing the value of the variable order:

DECLARE FUNCTION isWord& (wrd$)
DECLARE SUB chooseCol (p%)
DEFINT A-Z
DATA aeilnorstu,dg,bcmp,fhvwy,k,,,jx,,qz
DIM SHARED letval(26)
FOR v = 1 TO 10
 READ vl$
 FOR i = 1 TO LEN(vl$)
   letval(ASC(MID$(vl$, i, 1)) - 96) = v
 NEXT
NEXT v
FOR i = 1 TO 26: PRINT letval(i); : NEXT
DIM SHARED used(26), order, w$, w0$, wc$(5)

order = 4

filen$ = "\words\words" + LTRIM$(STR$(order))

OPEN filen$ + ".txt" FOR BINARY AS #1
OPEN filen$ + ".idx" FOR BINARY AS #2
w$ = SPACE$(order)
DO
 p$ = w$
 GET #1, , w$
 wct = wct + 1
 IF EOF(1) THEN EXIT DO
 IF LEFT$(w$, 1) <> LEFT$(p$, 1) THEN
   PUT #2, , wct
 END IF
LOOP
CLOSE


OPEN filen$ + ".txt" FOR BINARY AS #1
OPEN filen$ + ".idx" FOR BINARY AS #2
OPEN filen$ + ".txt" FOR BINARY AS #3
OPEN "dblwrdsq.txt" FOR OUTPUT AS #4
DO
 GET #1, , w$
 IF EOF(1) THEN EXIT DO
 wprv$ = w0$
 IF LEFT$(w$, 1) > LEFT$(wprv$, 1) THEN PRINT LEFT$(w$, 1)
 w0$ = w$
 good = 1
 FOR i = 1 TO order - 1
   IF INSTR(MID$(w0$, i + 1), MID$(w0$, i, 1)) THEN good = 0: EXIT FOR
 NEXT
 IF good THEN
   FOR i = 1 TO order
     used(ASC(MID$(w0$, i, 1)) - 96) = 1
   NEXT

   chooseCol 1

   FOR i = 1 TO order
     used(ASC(MID$(w0$, i, 1)) - 96) = 0
   NEXT
 END IF
LOOP
CLOSE

SUB chooseCol (p)
 psn = (ASC(MID$(w0$, p, 1)) - 96) * 2 - 1
 GET #2, psn, bgnwnum
 wdpos& = (bgnwnum - 1) * order + 1
 DO
   GET #3, wdpos&, w$
   IF EOF(3) THEN EXIT DO
   IF LEFT$(w$, 1) <> MID$(w0$, p, 1) THEN EXIT DO
   good = 1
   IF p = 1 THEN
     IF MID$(w$, 2, 1) <= MID$(w0$, 2, 1) THEN good = 0
   END IF
   FOR i = 1 TO LEN(w$) - 1
    IF INSTR(MID$(w$, i + 1), MID$(w$, i, 1)) THEN good = 0: EXIT FOR
   NEXT
   IF good THEN
     FOR i = 2 TO LEN(w$)
       j = ASC(MID$(w$, i, 1)) - 96
       IF used(j) THEN good = 0: EXIT FOR
     NEXT
     IF good THEN
       FOR i = 2 TO LEN(w$)
         j = ASC(MID$(w$, i, 1)) - 96
         used(j) = 1
       NEXT

       wc$(p) = w$
       IF p = order THEN
         tst2$ = MID$(wc$(1), 2, 1) + MID$(wc$(2), 2, 1) + MID$(wc$(3), 2, 1) + MID$(wc$(4), 2, 1)
         tst3$ = MID$(wc$(1), 3, 1) + MID$(wc$(2), 3, 1) + MID$(wc$(3), 3, 1) + MID$(wc$(4), 3, 1)
         tst4$ = MID$(wc$(1), 4, 1) + MID$(wc$(2), 4, 1) + MID$(wc$(3), 4, 1) + MID$(wc$(4), 4, 1)
         tst2$ = LTRIM$(RTRIM$(tst2$))
         tst3$ = LTRIM$(RTRIM$(tst3$))
         tst4$ = LTRIM$(RTRIM$(tst4$))
         IF isWord(tst2$) THEN
         IF isWord(tst3$) THEN
         IF order = 3 THEN
          ok = 1
         ELSEIF isWord(tst4$) THEN
           ok = 1
         ELSE
           ok = 0
         END IF

         IF ok THEN
           totpts = 0
           FOR i = 1 TO 26
             IF used(i) THEN
               totpts = totpts + letval(i)
             END IF
           NEXT
           PRINT w0$
           PRINT tst2$
           PRINT tst3$
           PRINT tst4$, totpts
           PRINT
           PRINT #4, w0$
           PRINT #4, tst2$
           PRINT #4, tst3$
           PRINT #4, tst4$, totpts
           PRINT #4,
         END IF
         END IF
         END IF
       ELSE
          chooseCol p + 1
       END IF

       FOR i = 2 TO LEN(wc$(p))
         j = ASC(MID$(wc$(p), i, 1)) - 96
         used(j) = 0
       NEXT
     END IF
   END IF
   wdpos& = wdpos& + order
 LOOP
END SUB

DEFLNG A-Z
FUNCTION isWord (wrd$)
  n = LEN(wrd$)
  wrd1$ = SPACE$(n)
  l = LOF(1) / n
  low = 1: high = l
  DO
    mid = INT((low + high) / 2)
    GET #3, (mid - 1) * n + 1, wrd1$
    IF wrd1$ = wrd$ THEN isWord = -1: EXIT FUNCTION
    IF wrd1$ < wrd$ THEN low = mid + 1:  ELSE high = mid - 1
  LOOP UNTIL low > high
  isWord = 0
END FUNCTION


 


  Posted by Charlie on 2011-10-08 01:40:50
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information