Guest User

Challenge #6 - Code #1 - Explanation

a guest
Oct 24th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. The Input of http://pastebin.com/NLDbsStu is: "IF YOU CANT CHANGE YOUR MIND THEN YOURE NOT USING IT".
  2.  
  3. Code #1 is the simpler of the two, but is also similar to the 3rd code.
  4.  
  5. This code is also very picky & not very good to be honest.
  6. You can't encode words that contain multiple instances of the same letter, (Good, hello, test).
  7. Since each word when encoded outputs to 26 characters long, There's a very small amount of words you can encode before needing to output to another set of 26 characters.
  8. The only reason I used this code for this challenge was because it was only meant for the challenge, nothing else.
  9.  
  10. Step by step of Encoding:
  11.  
  12. Input: "The Word"
  13.  
  14. 1. Think of the output, 26 characters, as positions.
  15.  
  16. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  17.  
  18. 2. The letters represent the order, So now we need to assign the ordering to our input:
  19.  
  20. Input: T H E
  21. Order: A B C
  22.  
  23. Input: W O R D
  24. Order: A B C D
  25.  
  26.  
  27. 2. 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.
  28.  
  29. (T)HE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ A _ _ _ _ _ _
  30. (A)BC
  31.  
  32. (TH)E _ _ _ _ _ _ _ B _ _ _ _ _ _ _ _ _ _ _ A _ _ _ _ _ _
  33. (AB)C
  34.  
  35. (THE) _ _ _ _ C _ _ B _ _ _ _ _ _ _ _ _ _ _ A _ _ _ _ _ _
  36. (ABC)
  37.  
  38. To speed things up:
  39.  
  40. (THE) _ _ _ _ C _ _ B _ _ _ _ _ _ _ _ _ _ _ A _ _ _ _ _ _
  41. (ABC)
  42.  
  43. (WORD) _ _ _ D _ _ _ _ _ _ _ _ _ _ B _ _ C _ _ _ _ A _ _ _
  44. (ABCD)
  45.  
  46.  
  47. 3. Now for the repetitive letters, Once the Order letters have been positioned you repeat those letters to the left as much as you can until it meets a different Order letter.
  48.  
  49.  
  50. (T)HE _ _ _ _ C _ _ B A A A A A A A A A A A A _ _ _ _ _ _
  51. (A)BC
  52.  
  53. (TH)E _ _ _ _ C B B B A A A A A A A A A A A A _ _ _ _ _ _
  54. (AB)C
  55.  
  56. Once it reaches the end, it will just repeat and wrap around:
  57.  
  58. (THE) C C C C C B B B A A A A A A A A A A A A C C C C C C
  59. (ABC)
  60.  
  61. To speed things up:
  62.  
  63. (THE) C C C C C B B B A A A A A A A A A A A A C C C C C C
  64. (ABC)
  65.  
  66. (WORD) D D D D B B B B B B B B B B B C C C A A A A A D D D
  67. (ABCD)
  68.  
  69.  
  70. That's all there is to this code. :D
  71.  
  72. Thanks for participating for Code #1! :D
  73.  
  74.  
  75. - DWC
  76.  
  77. ----------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment