Guest User

Challenge #6 - Code #3 - Explanation

a guest
Oct 25th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. The Input of http://pastebin.com/F9ZDQZYC is: "THE EYES ARE USELESS WHEN THE MIND IS BLIND".
  2.  
  3.  
  4. Code #3 is like Code #1 but you're now able to use multiple instances of the same letter and its output varies.
  5.  
  6. Our input will be: "HELLO WORLD" and we'll encode one word at a time.
  7.  
  8. HELLO is 5 characters long, meaning we need to make a 5x5 square & fill in the alphabet.
  9.  
  10. 1 2 3 4 5
  11. 1 A B C D E
  12. 2 F G H I J
  13. 3 K L M N O
  14. 4 P Q R S T
  15. 5 U V W X Y
  16.  
  17. Since we've filled the whole 5x5 square with most of the alphabet(A-Y), the "Z" will be apart of the next group(A) of 5x5 squares.
  18.  
  19. ------------1st GROUP has no Group letter------------
  20. 1 2 3 4 5
  21. 1 A B C D E
  22. 2 F G H I J
  23. 3 K L M N O
  24. 4 P Q R S T
  25. 5 U V W X Y
  26. ------------2nd Group will be defined by "A"------------
  27. 1 2 3 4 5
  28. 1 Z _ _ _ _
  29. 2 _ _ _ _ _
  30. 3 _ _ _ _ _
  31. 4 _ _ _ _ _
  32. 5 _ _ _ _ _
  33.  
  34.  
  35. Our output will now have a padding of "X"'s, and it will be as long as how many spots are in the group (in this case, 5x5=25)
  36.  
  37. XXXXXXXXXXXXXXXXXXXXXXXXX
  38.  
  39.  
  40. Just like Code #1, Knowing the number form of letters, A=1,B=2,C=3...Z=26, We now place the order letter in the position of the letter's number.
  41.  
  42. (H)ELLO XXXXXXX1XXXXXXXXXXXXXXXXX
  43.  
  44. If our first letter happened to be "Z", then we would know that "Z" is apart of GROUP A, BUT is in the 1st postion in the 5x5 grid, meaning:
  45.  
  46. Our Z, (1st character being encoded: Order number = 1), would be in the 1st postion of our output:
  47.  
  48. (Z)ello (X)XXXXXXXXXXXXXXXXXXXXXXXX
  49.  
  50. (Z)ello (1)XXXXXXXXXXXXXXXXXXXXXXXX
  51.  
  52. Since "Z" is in Group A, we need to show that in your output by adding ".A" after the "1":
  53.  
  54. (Z)ello (1.A)XXXXXXXXXXXXXXXXXXXXXXXX
  55.  
  56. and it would look like this:
  57.  
  58. (Z)ello 1.AXXXXXXXXXXXXXXXXXXXXXXXX
  59.  
  60.  
  61. Now back to our actual input: H(E)LLO
  62.  
  63. H(E)LLO XXXX2XX1XXXXXXXXXXXXXXXXX
  64.  
  65. HE(L)LO XXXX2XX1XXX3XXXXXXXXXXXXX
  66.  
  67.  
  68. Now we have a 2nd instance of the same letter (two L's), All we do to show that multple letters are apart of that position is add a "|" between them:
  69.  
  70. HEL(L)O XXXX2XX1XXX3|4XXXXXXXXXXXXX
  71.  
  72. HELL(O) XXXX2XX1XXX3|4XX5XXXXXXXXXX
  73.  
  74.  
  75. and if we had to encode a letter from a different group, same rules apply.
  76.  
  77. If you find it a bit hard to understand when trying to decode, space out the columns:
  78.  
  79. Final:
  80. HELLO = XXXX2XX1XXX3|4XX5XXXXXXXXXX
  81.  
  82. Final with 25 columns spaced out:
  83. HELLO = X X X X 2 X X 1 X X X 3|4 X X 5 X X X X X X X X X X
  84.  
  85.  
  86. To save time, Here is how the rest of the input would look:
  87.  
  88.  
  89. HELLO WORLD:
  90.  
  91. XXXX2XX1XXX3|4XX5XXXXXXXXXX
  92. XXX5XXXXXXX4XX2XX3XXXX1XXX
  93.  
  94.  
  95. Essentially, you can also do the same thing as Code #1 and repeat the numbers if you wanted to:
  96.  
  97. HELLO WORLD:
  98.  
  99. 222221113333|45552222222222
  100. 55554444444422233311111555
  101.  
  102.  
  103. That's all there is to this code. :D
  104.  
  105. Thanks for participating for Code #1! :D
  106.  
  107.  
  108. - DWC
Advertisement
Add Comment
Please, Sign In to add comment