"hi scene" is an anagram of
Chinese"laguna rib" is an anagram of
Bulgarian
You will be exposed to some more exotic /esoteric languages by decoding the following anagrams:
anti ail
reek echo
reopens at
puna air
gaol tag
near ok
AI march
a sniper
Good luck!
In alphabetic order by the language:
aimarch amharic
reekecho cherokee
reopensat esperanto
antiail italian
nearok korean
punaair rapanui
gaoltag tagalog
Persian (from a sniper) is missing, as the Wikipedia list of languages lists Persian itself as a Macrolanguage rather than an Individual language and only Judeo-Persian and Old Persian as individual languages, which is what the program was looking for.
Option Base 1
DefDbl A-Z
Dim crlf$, anagram$(8)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
' Open "b5 projectslooblelanguages.txt" For Input As #1
' Open "b5 projectslooblelanguages2.txt" For Output As #2
' Do
' prev$ = l$
' Line Input #1, l$
' l$ = LTrim(RTrim(LCase(l)))
' If l = "individual" Then Print #2, prev
' Loop Until EOF(1)
' Close
anagram$(1) = "antiail"
anagram$(2) = "reekecho"
anagram$(3) = "reopensat"
anagram$(4) = "punaair"
anagram$(5) = "gaoltag"
anagram$(6) = "nearok"
anagram$(7) = "aimarch"
anagram$(8) = "asniper"
Open "languages2.txt" For Input As #1
Do
Line Input #1, l$
savel$ = l
ix = InStr(l, "(")
If ix Then l = Left(l, ix - 1)
Do
ix = InStr(l, " ")
If ix = 0 Then Exit Do
l = Left(l, ix - 1) + Mid(l, ix + 1)
Loop
For i = 1 To 8
If isAnag(l, anagram(i)) Then
Text1.Text = Text1.Text & anagram(i) & " " & savel & crlf
End If
Next
Loop Until EOF(1)
Close
Text1.Text = Text1.Text & crlf & " done"
End Sub
Function isAnag(a$, b$)
If Len(a) <> Len(b) Then isAnag = 0: Exit Function
x$ = a$: y$ = b$
Do
done = 1
For i = 1 To Len(x) - 1
If Mid(x, i, 1) > Mid(x, i + 1, 1) Then
h$ = Mid(x, i, 1)
Mid(x, i, 1) = Mid(x, i + 1, 1)
Mid(x, i + 1, 1) = h
done = 0
End If
Next
Loop Until done
Do
done = 1
For i = 1 To Len(y) - 1
If Mid(y, i, 1) > Mid(y, i + 1, 1) Then
h$ = Mid(y, i, 1)
Mid(y, i, 1) = Mid(y, i + 1, 1)
Mid(y, i + 1, 1) = h
done = 0
End If
Next
Loop Until done
If x = y Then isAnag = 1 Else isAnag = 0
End Function
The commented out portion of the program was executed only once to create the file that was easier to use in finding the matches, and then it was commented out during development of the search.
Also discovered that the Array method of initializing arrays apparently does not work for strings in VB 5.
Edited on September 1, 2015, 4:46 pm
|
Posted by Charlie
on 2015-09-01 16:09:14 |