datkewlguy Posted March 4, 2005 Share Posted March 4, 2005 this will be very difficult, i am trying to write a converter that will translate english into this code of mine. The "code" is simple. apple = aeplp, bascially you take first letter, cross it off, take last letter, cross it off, and then continue. Reading it is easy as well, start with the first letter, then read every other letter until you arrive at the last or second to last letter. Upon getting to this letter you read the one next to it that you havent read before (in aeplp. you arrive at p and then go to L.) then you continue to do the same thing going backwards. Okay i understand that this sounds really retarded and that you all are probably busy but if any of you have some free time do you think you could figure it out? It is too advanced for my n00bish mind or i'd deal with it myself. Thanks in advance... Link to comment Share on other sites More sharing options...
Valik Posted March 4, 2005 Share Posted March 4, 2005 Here's a transformation which scrambles the word. I leave a descrambler to you. A descrambler may be slightly harder, but you should be able to figure it out by studying this code. Main() Func Main() Local $s = "apple" Local $sExpected = "aeplp" Local $sResult = ConvertString($s) If $sResult <> $sExpected Then MsgBox(4096, "", "Failed: " & @CRLF & $sResult) Else MsgBox(4096, "", "Success: " & @CRLF & $sResult) EndIf EndFunc Func ConvertString($s) Local $sRes = "" Local $i = 0 While StringLen($s) Local $index = 1 $i = $i + 1 If Not Mod($i, 2) Then $index = StringLen($s) $sRes = $sRes & ConsumeCharacter($s, $index) WEnd Return $sRes EndFunc ; Eats a character from a string and returns the character Func ConsumeCharacter(ByRef $s, $index) Local $sBegin, $sEnd, $cChar $cChar = StringMid($s, $index, 1) $sBegin = StringLeft($s, $index-1) $sEnd = StringRight($s, StringLen($s)-$index) $s = $sBegin & $sEnd Return $cChar EndFunc Link to comment Share on other sites More sharing options...
datkewlguy Posted March 5, 2005 Author Share Posted March 5, 2005 hey thanks that works perfectly, but you over estimate me lol. anyone know how i can make the decryption for this? Link to comment Share on other sites More sharing options...
datkewlguy Posted March 5, 2005 Author Share Posted March 5, 2005 im going insane, someone plz help, im so confused with this script! Link to comment Share on other sites More sharing options...
phillip123adams Posted March 5, 2005 Share Posted March 5, 2005 im going insane, someone plz help, im so confused with this script!<{POST_SNAPBACK}>Here's a version I did a while ago. It scrambles a little differently because it starts with the last character, then the first, and so on.expandcollapse popup;; For Testing ;$sOrig = "Apple" $sOrig = "AutoIt3 is the best!" $sScrambled = _Scramble($sOrig) $sDeScrambled = _DeScramble($sScrambled) MsgBox(4096, "test", "$sOrig = " & $sOrig &@LF& "$sScrambled = " & $sScrambled &@LF& "$sDeScrambled = " & $sDeScrambled) Exit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _Scramble($sText) ;; Scramble a text string. $iLen = StringLen($sText) $Scrambled = "" For $i1 = 1 To Int($iLen / 2) $Scrambled = $Scrambled & StringMid($sText, $iLen - $i1 + 1, 1) & StringMid($sText, $i1, 1) Next; $i1 ; Pick up the odd character. If Mod($iLen, 2) Then $Scrambled = $Scrambled & StringMid($sText, $i1, 1) EndIf Return $Scrambled EndFunc ;==>_Scramble ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _DeScramble($sText) ;; De-Scramble a Scrambled text that was scrambled by _Scramble. Local $iLen = StringLen($sText) Local $i, $DeScrambled1, $DeScrambled2 $DeScrambled1 = "" $DeScrambled2 = "" For $i1 = 1 To $iLen step 2 $DeScrambled1 = StringMid($sText, $i1, 1) & $DeScrambled1 $DeScrambled2 = $DeScrambled2 & StringMid($sText, $i1 + 1, 1) Next; $i1 ; Pick up the odd character. If Mod($iLen, 2) Then $DeScrambled1 = StringMid($sText, $i1, 1) & $DeScrambled1 EndIf $sText = $DeScrambled2 & $DeScrambled1 Return $DeScrambled2 & $DeScrambled1 EndFunc ;==>_DeScramble iamkoshr 1 Phillip Link to comment Share on other sites More sharing options...
steveR Posted March 5, 2005 Share Posted March 5, 2005 sounds like a job for the regexp lib AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
Insolence Posted March 5, 2005 Share Posted March 5, 2005 Regexp lib? You mean RegExp function? "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
steveR Posted March 5, 2005 Share Posted March 5, 2005 yeah, the _RegExp udf is what i meant AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
Insolence Posted March 5, 2005 Share Posted March 5, 2005 Where's that located? "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
steveR Posted March 5, 2005 Share Posted March 5, 2005 (edited) Hmmm? server reset?_RegEx() UDF here:http://www.autoitscript.com/fileman/users/public/piccaso/_regex.zip Edited March 5, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
Insolence Posted March 5, 2005 Share Posted March 5, 2005 Thanks, coulda sworn it was already in the core "I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now