Give students a caesar cipher to reveal a picture or message in order to teach how characters can be treated as numbers and to reinforce string manipulation.

  • Manipulating characters as they would numbers can be confusing for students.
    • Be sure to explain to students how letters can be represented by numbers.
  • Start students with a large file of text that, when they properly reverse a caesar cipher it, reveals cow ascii art (don’t tell them it will reveal cow ascii art, it’s better to keep it a secret).
    • Tell students that the letters in the file are shifted by a specific number then tell them that number.
      • This assignment isn’t about figuring out the number the characters have been shifted by.
    • Tell students they’ll know what it is supposed to be when they get it right!
      • They may be skeptical because they don’t know that the file contains an ascii art cow.
  • When students finally reverse the caesar cipher and see the cow ascii art, they get really excited!
    • When completing this assignment in a lab setting, students have more incentive to finish their program after seeing one student successfully uncover the cow.
  • Check out this example of a jumbled file and the corresponded code for the caesar cipher.
  • Below is an example of an ascii cow:
       .=     ,        =.
     _  _   /'/    )\,/,/(_   \ \
      `//-.|  (  ,\\)\//\)\/_  ) |
      //___\   `\\\/\\/\/\\///'  /
   ,-"~`-._ `"--'_   `"""`  _ \`'"~-,_
   \       `-.  '_`.      .'_` \ ,-"~`/
    `.__.-'`/   (-\        /-) |-.__,'
      ||   |     \O)  /^\ (O/  |
      `\\  |         /   `\    /
        \\  \       /      `\ /
         `\\ `-.  /' .---.--.\
           `\\/`~(, '()      ('
            /(O) \\   _,.-.,_)
           //  \\ `\'`      /
     jgs  / |  ||   `""""~"`
        /'  |__||
              `o

More about this tip

External Source

Interview with Brandon R. Rodriguez