Jump to content

Word Scrammbler


CodyBarrett
 Share

Recommended Posts

Here's a version that can handle any punctuation you throw at it ?!@#&,.

Edit: Mdiesel, I would like some "scambled" eggs too! : )

$text = "Overall, particularly Unintelligent people might discover serious problems whilst attempting converting scambled dialog including punctuation!!"
MsgBox(48, "Can you read it?", _Scramble($text))

Func _Scramble($text)
    $letter = StringSplit($text,"")
    $count = 1
    $startofWord = True
    dim $word[$letter[0]+1][2]
    For $n = 1 to $letter[0]
        If StringIsAlpha($letter[$n]) = 1 and $startofWord = True Then
            $word[$count][0] = $n
            $startofWord = False
        ElseIf StringIsAlpha($letter[$n]) = 0 and $startofWord = False Then
            $word[$count][1] = $n - 1
            $startofWord = True
            $count += 1
        ElseIf $n = $letter[0] Then
            $word[$count][1] = $n
        EndIf
    Next
    For $n = 1 to $count
        If $word[$n][1]-$word[$n][0] > 2 Then
            $wordBuff = ""
            $wordTest = ""
            For $i = 1 to $word[$n][1]-$word[$n][0]
                $wordBuff &= $letter[$word[$n][0]+$i]
            Next
            For $i = 1 to $word[$n][1]-$word[$n][0]
                $random = Random($word[$n][0]+1, $word[$n][1]-1, 1)
                $randomTwo = Random($word[$n][0]+1, $word[$n][1]-1, 1)
                $buff = $letter[$random]
                $letter[$random] = $letter[$randomTwo]
                $letter[$randomTwo] = $buff
            Next
            For $i = 1 to $word[$n][1]-$word[$n][0]
                $wordTest &= $letter[$word[$n][0]+$i]
            Next
            If $wordTest = $wordBuff Then
                $n -= 1
            EndIf
        EndIf
    Next
    $text = ""
    For $n = 1 to $letter[0]
        $text &= $letter[$n]
    Next
    return $text
EndFunc
Edited by DisabledMonkey
Link to comment
Share on other sites

disabledMonkey:

your code looks even more impressive if you use this:

$text = "Overall, particularly Unintelligent people might discover serious problems whilst attempting converting scambled dialog including punctuation!!"
MsgBox(48, "Can you read it?", _Scramble($text))

long words work best, including 3 letter words does not work, such as wow.

Link to comment
Share on other sites

Spiff59's Version with some symbols

BTW very nice and clean spiff59 I had to mess it up lol

MsgBox (48, "Results", Scramble2('In Theory! Only 5% of people can read this, & others are not very smart "stupid" now give me some $ (money)'))
Func Scramble2($stringin)
   Local $word, $stringout, $r, $i, $j
    $Sentence = StringSplit ($stringin, ',. !@#$%^&*:;"?/><|\[]{}=+-_`~1234567890')
    For $h= 1 to $Sentence[0]
        $Word = StringSplit($Sentence[$h], '')
        $j += $word[0] + 1
        If $word[0] Then $stringout &= $Word[1]                
        For $i= $Word[0] -1 to 2 Step -1
            $r = Random(0, $i - 2) + 2
            $stringout &= $Word[$r]
            $Word[$r] = $Word[$i]
        Next
        If $word[0] Then $stringout &= $Word[$word[0]]                
        $stringout &= StringMid($stringin, $j, 1)
    Next
    Return $stringout
EndFunc; ==>

EDIT: YAY MY 100th POST YAY ME!

Edited by lordicast
[Cheeky]Comment[/Cheeky]
Link to comment
Share on other sites

Ok..

i have finished it... well.. except UNSCRAMMBLING the words... i have stringtohex.... stringtobinary and scrammblestring in there... i have uploaded the background GUI.bmp and there is ONE teeny tiny bug... the binary to string doesn't support white spaces.... ahwell

updated at the top

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...