Skip to content

Instantly share code, notes, and snippets.

@doyle
Created July 12, 2020 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doyle/eaf78f9a3cab38d18b9c22446d108a70 to your computer and use it in GitHub Desktop.
Save doyle/eaf78f9a3cab38d18b9c22446d108a70 to your computer and use it in GitHub Desktop.
# decrypts messages in the Futurama AL2 language: https://theinfosphere.org/Alien_languages
encrypted_message = %w(19 0 4 21 25 17 4 18 10 4 6 13 6 13 21 8 14 14 6 25 21 9).map(&:to_i)
decrypted_message = ''
encrypted_message.each_with_index do |value, index|
if index > 0
value = value - encrypted_message[index - 1]
value = value >= 0 ? value : 26 + value
end
decrypted_message << (97 + value).chr
end
puts "Decrypted: #{decrypted_message}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment