[challenge] tiny scrambler 06-01-2015, 01:24 PM
#1
Wow, a challenge that doesn't involve generating stuff!
The purpose of this one is to take user input and scramble it.
The difference between this and my other challenges is you'll need to provide 2 programs: one for scrambling it, and one for deciphering the scrambled text. Providing sample input/outputs is appreciated, too.
Rules:
-No imports (of any kind, including bash)
-No more than one loop per program
-10 NSP prize for lowest score (negatives possible)
Score calculation:
average lines(add both programs and divide by 2) - complexity(chosen by me, 1 is crap; 10 is ridiculous)
Scores:
@"Chitoge": 1
@Eclipse: -1.5
The purpose of this one is to take user input and scramble it.
The difference between this and my other challenges is you'll need to provide 2 programs: one for scrambling it, and one for deciphering the scrambled text. Providing sample input/outputs is appreciated, too.
Rules:
-No imports (of any kind, including bash)
-No more than one loop per program
-10 NSP prize for lowest score (negatives possible)
Score calculation:
average lines(add both programs and divide by 2) - complexity(chosen by me, 1 is crap; 10 is ridiculous)
Spoiler: My solution (Ruby):
Score: 1 (3 line average - 2 complexity)
Scramble:
Decipher:
I/O:
Scramble:
Code:
chars = [("a".."z").to_a, ("0".."9").to_a, "a", "b"].flatten
message = gets.chomp.downcase.split("")
message.each { |l| l = chars[chars.index(l) + 2] if chars.include?(l); print l }Decipher:
Code:
chars = [("a".."z").to_a, ("0".."9").to_a, "a", "b"].flatten
message = gets.chomp.downcase.split("")
message.each { |l| l = chars[chars.index(l) - 2] if chars.include?(l); print l }I/O:
Code:
test 123
=> rcqr z01Scores:
@"Chitoge": 1
@Eclipse: -1.5
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.

















![[+]](https://sinister.li/images/modern/collapse_collapsed.png)










![[Image: CDUAq9d.png]](http://i.imgur.com/CDUAq9d.png)

