## Decoding the Poem in the Pigeons

Thank you so much for reading This Mortal Coil, and for stopping by this page. In the book, Catarina discovers a string within the DNA of the passenger pigeons that she decodes, discovering a poem. The method Cat follows is detailed in the book:

*“… I translated the base pairs into binary, then ASCII and finally into a string of alphanumeric letters.” *

Now you, too, can decode the poem for yourself. There are multiple ways to do this. If you’re not into coding, there’s a tool on this site you can use that I’ll link to below. However, I’d encourage you to give this puzzle a shot on your own. Lower on this page, I’ve included an explanation of the steps to follow, and a link to a jsfiddle where I’ve written a quick algorithm in jquery/javascript.

If you do create your own decoding (and/or encoding) algorithms, I would LOVE to see them! Can you code one in R or Python? What about a solution in Google Sheets? Tag me in a post on social media or contact me through this site and I’ll try to check them out. If your tool is especially awesome, I’ll even link to it on this page!

## How to get the Text

Okay, so now that it’s been a little while since the book was released, I’ve decided to add the encoded text of the poem to this site. So here it is, in GTCA-form:

First Quatrain:

Second Quatrain:

Third Quatrain:

The Couplet:

## Decoding the Text

If you have the encoded poem and just want to jump straight into decoding it, you can use this tool on my site:

Please note that you’ll need to enter text with character counts that are a multiple of 8, and if you have one letter missing in the middle of a string of text, everything after it will be nonsense, or may not decode!

### But I want to do it myself…

Awesome! Okay, let’s talk a little bit about how to do that. First, let’s break the problem down into steps, based on the book:

1) Cat says she converts the base pairs into binary…

2) then ASCII…

3) and finally into a string of alphanumeric letters.

Let’s talk through these steps one at a time. Depending on what language you’re coding in, you might mix up the way these steps are done. But let’s step through them like this anyway.

#### Converting the base pairs to binary

Cat says she converts the “base pairs into binary”. For information on binary numbers, check out this cool site. But how does Cat convert to binary, when there are four bases in DNA (G,T,C, and A) and only two bases in binary (0 and 1)? Is there any reason you can think of to put the letters into two groups? (*Hint: they’re called base pairs for a reason…*)

Once you’ve figured out which letters go together, you’ll have to build a mapping from each letter to either 1 or 0. I’m going to tell you now that A maps to 0, and C maps to 1. So if we have a string of letters: ACACACAC, and A -> 0, and C -> 1, then this would be converted to the binary number 01010101.

Your first job in decoding the message is figuring out the rest of this mapping, and then thinking about what commands you would use in your preferred language to change the letters in a long string of text. At the end of this step, you should have a long string of binary numbers, i.e. 010101010101010101010101 etc.

#### Converting binary to ASCII

Again, for information on binary numbers, check out this cool site. For information on ASCII, you can check out this table here.

For this step in the decoding process, you’ll need to split up your long string of binary digits into smaller sections. One thing you’ll notice about ASCII is that there are 128 characters in the ASCII system. This is because these characters can be represented by 8 “bits”, in the form of an 8-digit binary number. So once you have a long string of binary, you’ll need to chop it up into sections of 8 digits, and then turn those 8-digit numbers into decimals. This step requires you to understand binary numbers – so check out the link above!

For example, the string: 010101010101110001011111 would be split into three numbers: 01010101, 01011100, and 01011111. Depending on what language you’re coding in, you might split this text up in a loop over all letters, a loop over every eight letters, or you may be able to use a command to split the long string into shorter ones in one step.

Once you are dealing with 8-digit binary numbers, they can be re-written as decimal numbers: 01010101, 01011100, and 01011111 become 85, 92, and 95. When you’re done with this step you should be dealing with numbers between 0 and 127. If you take a look at the ASCII table linked above, you can see we’re almost done.

#### Converting ASCII to Alphanumeric Letters

This is the last step! By now you should be working with numbers like 85, 92, 95, etc. For this last step, you’ll need to use a built-in function in your preferred language to convert these numbers to letters. For instance, 85 -> “U”, 92 -> “\”, and 95 -> “_”. To find the command for your preferred language, Google is your friend! At the end of this step, you should have the full text!

### Examples

Okay – example time! I’ve created a working example here, at JSfiddle: https://jsfiddle.net/emilysuvada/Lnvwkgbn/

It’s in JQuery and javascript, but I’ve commented it to make it somewhat readable. If you have a working example, please send me a link, either on my Contact Page, or via email (emilysuvadaauthor (at) gmail.com)! I’d love to link to it on this page!

### Reader-Created Code

Alexander created a java algorithm to decode the poem and posted it at GitHub! Check it out here!