|
-
Oct 14th, 2000, 12:36 PM
#1
Thread Starter
New Member
I am learning VB6 as a hobby. I am trying to make a little
program that would solve the "jumble" words (i.e. like
the puzzles found in the newspaper). As the following
code indicates, the letters "otpoh" can be rearranged
to (eventually!) spell out the word "photo."
But my problem is that letters are used over and over
again! (For example, "oopo", etc.)A less serious problem
is that these five letters are not neatly divided into
words.
' Code that goes under the "Go" command...
Randomize Timer
For Counts = 1 To 3
scramword = "otpoh"
x = Int(Rnd(1) * 6)
Select Case x
Case Is = 1
Print Mid(scramword, 1, 1);
Case Is = 2
Print Mid(scramword, 2, 1);
Case Is = 3
Print Mid(scramword, 3, 1);
Case Is = 4
Print Mid(scramword, 4, 1);
Case Is = 5
Print Mid(scramword, 5, 1);
End Select
Can anyone help?
THANKS IN ADVANCE!
Richard G.
-
Oct 14th, 2000, 12:56 PM
#2
transcendental analytic
Code:
Function ScrambleWord(Aword As String) As String
Dim a() As Byte, x As Integer, temp As Byte, flipa As Integer, flipb As Integer
a = StrConv(Aword, vbFromUnicode)
For x = 0 To 20
flipa = Int(Rnd * Len(Aword))
flipb = Int(Rnd * Len(Aword))
temp = a(flipb)
a(flipb) = a(flipa)
a(flipa) = temp
Next x
ScrambleWord = StrConv(a, vbUnicode)
End Function
'to use
MsgBox ScrambleWord("otpoh")
[Edited by kedaman on 10-14-2000 at 01:59 PM]
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|