Set A consists of 8 words:
(face,hear,know,land,lover,olive,overt,seven)
Set B as well:
(seize,story,pride,iron,there,easy,table,tubal)
Let us match each word of set A with such a word from set B, that by erasing one letter from each and joining them together a new valid word is formed and matches will be found for all.
To make things clear I match
FACE & STORY to create FACTORY.
Now you match all others.
DefDbl A-Z
Dim crlf$, setA$(8), setB$(8)
Private Sub Form_Load()
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
setA(1) = "face"
setA(2) = "hear"
setA(3) = "know"
setA(4) = "land"
setA(5) = "lover"
setA(6) = "olive"
setA(7) = "overt"
setA(8) = "seven"
setB(1) = "seize"
setB(2) = "story"
setB(3) = "pride"
setB(4) = "iron"
setB(5) = "there"
setB(6) = "easy"
setB(7) = "table"
setB(8) = "tubal"
For a = 1 To 8
For b = 1 To 8
If a = 1 And b = 2 Then
xx = xx
End If
For i = 1 To Len(setA(a))
For j = 1 To Len(setB(b))
w$ = Left(setA(a), i - 1) + Mid(setA(a), i + 1) + Left(setB(b), j - 1) + Mid(setB(b), j + 1)
If isWord(w) Then
Text1.Text = Text1.Text & setA(a) & " "
Text1.Text = Text1.Text & setB(b) & " "
Text1.Text = Text1.Text & w & crlf
End If
w$ = Left(setB(b), i - 1) + Mid(setB(b), i + 1) + Left(setA(a), j - 1) + Mid(setA(a), j + 1)
If isWord(w) Then
Text1.Text = Text1.Text & setA(a) & " "
Text1.Text = Text1.Text & setB(b) & " "
Text1.Text = Text1.Text & w & crlf
End If
Next
Next
Next
Next
Text1.Text = Text1.Text & crlf & "done"
End Sub
Function isWord(x$)
DoEvents
w$ = Space$(Len(x$))
l = Len(x$)
If l = 0 Then isWord = 0: Exit Function
Open "\words\words" + LTrim$(Str$(l)) + ".txt" For Binary As #10
low = 1: high = LOF(10) / l
Do
midl = Int((high + low) / 2)
Get #10, (midl * l) + 1 - l, w$
If w$ = x$ Then Exit Do
If w$ > x$ Then high = midl - 1
If w$ < x$ Then low = midl + 1
Loop Until high < low
If w$ = x$ Then isWord = 1 Else isWord = 0
Close 10
End Function
finds
face story factory
face tubal factual
hear there heather
hear easy heresy
know there nowhere
land iron ladron
lover seize oversize
lover pride override
lover table overable
lover table loveable
olive table liveable
overt seize oversize
overt pride override
overt table overable
seven tubal eventual
but presumably what's wanted is a 1-to-1 correspondence between the two sets of words.
We can start with
face story factory (given; also, it leaves tubal available to seven to make eventual)
know there nowhere
land iron ladron (a robber or pirate, usually spelled ladrone in English)
olive table liveable
seven tubal eventual
then
hear easy heresy
but lover and overt can dispute who gets seize and who gets pride:
lover seize oversize
overt pride override
or
lover pride override
overt seize oversize
|
Posted by Charlie
on 2020-07-15 22:52:22 |