The file words31.txt and words32.txt contain a list of 3-letter words, the former in ordinary alphabetical order and the latter sorted first on the second letter of each word.
DECLARE SUB addOn ()
OPEN "words31.txt" FOR BINARY AS #1
OPEN "words32.txt" FOR BINARY AS #2
OPEN "4-3srot.txt" FOR OUTPUT AS #3
DIM SHARED h$(8), lvl, nWds, w$, beg(2, 26), ct
nWds = LOF(1) / 3
PRINT nWds
w$ = " "
FOR i = 1 TO nWds
GET #1, , w$
IF LEFT$(w$, 1) <> pLet$ THEN
pLet$ = LEFT$(w$, 1)
beg(1, INSTR("abcdefghijklmnopqrstuvwxyz", pLet$)) = i
PRINT pLet$; i;
END IF
NEXT i
PRINT
pLet$ = ""
FOR i = 1 TO nWds
GET #2, , w$
IF MID$(w$, 2, 1) <> pLet$ THEN
pLet$ = MID$(w$, 2, 1)
beg(2, INSTR("abcdefghijklmnopqrstuvwxyz", pLet$)) = i
PRINT pLet$; i;
END IF
NEXT i
PRINT
FOR i = 1 TO nWds
GET #1, i * 3 - 2, w$
IF w$ = LCASE$(w$) THEN
h$(1) = w$
lvl = 1
addOn
END IF
NEXT i
PRINT ct
SUB addOn
lvl = lvl + 1
IF lvl < 4 THEN
nxt2$ = MID$(h$(lvl - 1), 2)
ix = beg(1, INSTR("abcdefghijklmnopqrstuvwxyz", LEFT$(nxt2$, 1)))
IF ix > 0 THEN
DO
GET #1, ix * 3 - 2, w$
wLoc$ = w$
IF EOF(1) THEN EXIT DO
IF LEFT$(w$, 2) = nxt2$ THEN
h$(lvl) = w$
addOn
END IF
ix = ix + 1
LOOP UNTIL LEFT$(wLoc$, 2) > nxt2$
END IF
ELSEIF lvl = 9 THEN
FOR i = 1 TO 8
PRINT h$(i); " ";
PRINT #3, h$(i); " ";
NEXT
PRINT
PRINT #3,
ct = ct + 1
ELSEIF lvl = 8 THEN
nxt3$ = MID$(h$(7), 2, 1) + LEFT$(h$(1), 2)
ix = beg(1, INSTR("abcdefghijklmnopqrstuvwxyz", LEFT$(nxt3$, 1)))
IF ix > 0 THEN
DO
GET #1, ix * 3 - 2, w$
wLoc$ = w$
IF w$ = nxt3$ THEN
h$(lvl) = w$
addOn
END IF
ix = ix + 1
LOOP UNTIL wLoc$ > nxt3$ OR ix > nWds
END IF
ELSE
IF lvl = 4 THEN
nxt2$ = MID$(h$(lvl - 1), 3) + MID$(h$(lvl - 1), 2, 1)
ELSE
nxt2$ = LEFT$(h$(lvl - 1), 2)
END IF
ix = beg(2, INSTR("abcdefghijklmnopqrstuvwxyz", LEFT$(nxt2$, 1)))
IF ix > 0 THEN
DO
GET #2, ix * 3 - 2, w$
wLoc$ = w$
IF MID$(w$, 2) = nxt2$ AND (lvl <> 7 OR LEFT$(w$, 1) = LEFT$(h$(1), 1)) THEN
h$(lvl) = w$
addOn
END IF
ix = ix + 1
LOOP UNTIL MID$(wLoc$, 2) > nxt2$ OR ix > nWds
END IF
END IF
lvl = lvl - 1
END SUB
The words are presented in clockwise order around a square that is in its CCW configuration, so that the rotated position would be one position CW. As the words are presented in clockwise order, they alternate words from the unrotated square and words from the rotated square.
I manually deleted solutions involving unusual words. Then a second program was used to format the words into actual squares, as well as eliminate solutions that had duplicate words:
OPEN "4-3SROT.TXT" FOR INPUT AS #1
OPEN "4-3sform.txt" FOR OUTPUT AS #2
DO
LINE INPUT #1, l$
l2$ = LTRIM$(l$)
good = 1
FOR i = 1 TO 7
w$ = LEFT$(l2$, 3)
l2$ = LTRIM$(MID$(l2$, 4))
IF INSTR(l2$, w$) THEN good = 0: EXIT FOR
NEXT
IF good THEN
l$ = LTRIM$(l$)
abc$ = LEFT$(l$, 3)
gfe$ = MID$(l$, 17, 3)
d$ = MID$(l$, 7, 1)
h$ = MID$(l$, 29, 1)
PRINT #2, l$
PRINT #2, abc$
PRINT #2, h$; " "; d$
PRINT #2, gfe$
PRINT #2,
END IF
LOOP UNTIL EOF(1)
CLOSE
ado don one den ode god ago gad
ado
g n
ode
ado don one ken eke lek ale lad
ado
l n
eke
ado don one pen ape lap ala lad
ado
l n
ape
ado don one ten ate hat aha had
ado
h n
ate
ado don one wen awe haw aha had
ado
h n
awe
ado don one wen awe law ala lad
ado
l n
awe
ado don one wen ewe pew ape pad
ado
p n
ewe
ado don one yen aye hay aha had
ado
h n
aye
ado don one yen aye lay ala lad
ado
l n
aye
age gee eel ale pal spa asp sag
age
s e
pal
age gel ell all pal spa asp sag
age
s l
pal
ago god odd add pad spa asp sag
ago
s d
pad
ago god ode wed awe haw aha hag
ago
h d
awe
ago god ode wed awe law ala lag
ago
l d
awe
aha hat ate vet eve rev are rah
aha
r t
eve
ala lad ado god ego peg ape pal
ala
p d
ego
ala law awe dew ode god ago gal
ala
g w
ode
ala lay aye dey ode god ago gal
ala
g y
ode
ale let eta rat era per ape pal
ale
p t
era
ape pea ear era her she ash sap
ape
s a
her
ape pea eat eta het she ash sap
ape
s a
het
ape pee eel ale pal spa asp sap
ape
s e
pal
ape peg ego dog ado lad ala lap
ape
l g
ado
ape per era tar eta get age gap
ape
g r
eta
ape per era tar eta let ale lap
ape
l r
eta
ape per era tar eta yet aye yap
ape
y r
eta
ape pew ewe dew ode god ago gap
ape
g w
ode
ape pew ewe yew aye lay ala lap
ape
l w
aye
ate tea ear era her she ash sat
ate
s a
her
ate tea eat eta het she ash sat
ate
s a
het
ate tee eel ale pal spa asp sat
ate
s e
pal
awe wee eel ale pal spa asp saw
awe
s e
pal
awe wet eta rat era per ape paw
awe
p t
era
aye yea ear era her she ash say
aye
s a
her
aye yea eat eta het she ash say
aye
s a
het
aye yet eta rat era per ape pay
aye
p t
era
aye yew ewe dew ode god ago gay
aye
g w
ode
aye yew ewe new one don ado day
aye
d w
one
aye yew ewe pew ape lap ala lay
aye
l w
ape
dey eye yew ewe new one don ode
dey
o e
new
don one new ewe yew aye day ado
don
a e
yew
eat ate tee gee age tag eta tea
eat
t e
age
eat ate tee pee ape tap eta tea
eat
t e
ape
eat ate tee wee awe taw eta tea
eat
t e
awe
eat ate tee wee ewe yew eye yea
eat
y e
ewe
eta tat ate wet ewe yew eye yet
eta
y t
ewe
eta taw awe dew ode god ego get
eta
g w
ode
eve vet eta hat aha rah era rev
eve
r t
aha
get eta tar era per ape gap age
get
a a
per
god ode den one don ado gad ago
god
a e
don
god ode dew awe law ala gal ago
god
a e
law
god ode dew awe taw eta get ego
god
e e
taw
god ode dew ewe pew ape gap ago
god
a e
pew
god ode dew ewe yew aye gay ago
god
a e
yew
god ode dey aye lay ala gal ago
god
a e
lay
hat ate ten one don ado had aha
hat
a e
don
haw awe wed ode god ago hag aha
haw
a e
god
haw awe wen one don ado had aha
haw
a e
don
hay aye yen one don ado had aha
hay
a e
don
lad ado dog ego peg ape lap ala
lad
a o
peg
lap ape pen one don ado lad ala
lap
a e
don
lap ape pew ewe yew aye lay ala
lap
a e
yew
law awe wed ode god ago lag ala
law
a e
god
law awe wen one don ado lad ala
law
a e
don
lay aye yen one don ado lad ala
lay
a e
don
lay aye yew ewe pew ape lap ala
lay
a e
pew
lek eke ken one don ado lad ale
lek
a e
don
let eta tar era per ape lap ale
let
a a
per
one new ewe yew eye dey ode don
one
d w
eye
peg ego god ado lad ala pal ape
peg
a o
lad
per era rat eta let ale pal ape
per
a a
let
per era rat eta wet awe paw ape
per
a a
wet
per era rat eta yet aye pay ape
per
a a
yet
pew ewe wen one don ado pad ape
pew
a e
don
rah aha hat eta vet eve rev era
rah
e a
vet
rev eve vet ate hat aha rah are
rev
a e
hat
she her era ear pea ape sap ash
she
a r
pea
she her era ear tea ate sat ash
she
a r
tea
she her era ear yea aye say ash
she
a r
yea
she het eta eat pea ape sap ash
she
a t
pea
she het eta eat tea ate sat ash
she
a t
tea
she het eta eat yea aye say ash
she
a t
yea
spa pad add odd god ago sag asp
spa
a d
god
spa pal ale eel gee age sag asp
spa
a l
gee
spa pal ale eel pee ape sap asp
spa
a l
pee
spa pal ale eel tee ate sat asp
spa
a l
tee
spa pal ale eel wee awe saw asp
spa
a l
wee
spa pal all ell gel age sag asp
spa
a l
gel
tag age gee tee ate eat tea eta
tag
e e
ate
tap ape pee tee ate eat tea eta
tap
e e
ate
taw awe wee tee ate eat tea eta
taw
e e
ate
yet eta tar era per ape yap aye
yet
a a
per
yew ewe wee tee ate eat yea eye
yew
e e
ate
yew ewe wet ate tat eta yet eye
yew
e e
tat
|
Posted by Charlie
on 2008-08-06 17:03:38 |