| Author |
Timed 4 |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
Honestly I have no idea what they mean with their rules. Do they mean swap the characters, add to the ascii values, or do they mean make a new string selecting the odd characters plus the second?
Thanks, |
|
| Author |
RE: Timed 4 |
ynori7
Future Emperor of Earth

Posts: 1481
Location: #valhalla
Joined: 08.10.07 Rank: Diabolical |
|
They gave you pseudo code. If you can't understand that then you aren't ready for this challenge.
|
|
| Author |
RE: Timed 4 |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
final += final[i]?
I understand pseudo code, but that isn't correct, unless they mean append or something, and I don't want to waste my time. |
|
| Author |
RE: Timed 4 |
ynori7
Future Emperor of Earth

Posts: 1481
Location: #valhalla
Joined: 08.10.07 Rank: Diabolical |
|
Think of final as an empty string, and you just add characters to it in the right spot as you get to them while you trace through your scrambled string.
|
|
| Author |
RE: Timed 4 |
jjbutler88
Colemak User

Posts: 590
Location:
Joined: 22.04.07 Rank: Guru |
|
|
The_Gman wrote:
final += final[i]?
I understand pseudo code, but that isn't correct, unless they mean append or something, and I don't want to waste my time.
You code python, thats valid code for appending to a string.
|
|
| Author |
RE: Timed 4 |
Mouzi
Member

Posts: 144
Location: Finland
Joined: 08.08.06 Rank: God |
|
|
The_Gman wrote:
final += final[i]?
I understand pseudo code, but that isn't correct, unless they mean append or something, and I don't want to waste my time.
IMO you're right. There is actually an error in the pseudo code.
FOR i = 0; i < str.length; i++
IF isEvenOrZero(i)
final += final[i]
ELSE
final += final[i+2]
END FOR
final += final[1]
RETURN final
In the line where it says final += final[i] the final[i] would be null, because the final is a nonexistent variable at this point. It should actually say final += str[i], because str is the variable referred to on the first line. I believe str in this case refers to the string given in the challenge. Same goes for the next ones too (final[i+2] and final[1]). On the last line the final variable would still be null.

Steganographs
Edited by Mouzi on 14-09-08 12:11 |
|
| Author |
RE: Timed 4 |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
That makes a lot more sense.. I'll post in ten minutes with [hopefully] my success  |
|
| Author |
RE: Timed 4 |
The_Gman
Member
Posts: 30
Location:
Joined: 02.09.08 Rank: Mad User |
|
wait wait, what about the last odd character? str[i+2] clearly won't work.
And we're trying to REVERSE that algorithm, correct?
something like this? (although this won't run)
code = 'x'*len(word)
code[1] = word[len(word)-1]
for i in range (len(word)):
if (i%2 == 0):
code[i] = word[i]
else:
code[i+2] = word[i]
|
|