The reflection of letter $$\alpha$$ at distance $$n \in \mathbb{N}$$ is formed by the letter pair $$\alpha_{-n}\,\alpha_{+n}$$. The two letters of this reflection are determined by putting the alphabet clockwise around a circle, such that letter Z is followed by letter A.

reflection
The letter pair OC is the reflection of letter V (orange) at distance $$n = 7$$, because letter O is at 7 steps counterclockwise from letter V (blue) and letter C is at 7 steps clockwise from letter V (green).

The letter $$\alpha_{-n}$$ is then obtained by jumping $$n$$ steps counterclockwise in the alphabet around the circle from letter $$\alpha$$. The letter $$\alpha_{+n}$$ is obtained by jumping $$n$$ steps clockwise in the alphabet around the circle from letter $$\alpha$$. This way, the letters $$\alpha_{-n}$$ and $$\alpha_{+n}$$ are each other's reflection relative to letter $$\alpha$$. For example, the letter pair OC is the reflection of letter V (orange) at distance $$n = 7$$, because letter O is at 7 steps counterclockwise from letter V (blue) and letter C is at 7 steps clockwise from letter V (green).

The Narcissus cipher encodes a message by replacing each letter with its reflection at distance $$n \in \mathbb{N}$$. The letters of the first word of the message are encoded with distance $$n=1$$, the letters of the second word with distance $$n=2$$, the letters of the third word with distance $$n=3$$, and so on. The words of the message consist of the longest possible succession of letters. Two words are therefore always separated by one or more characters that are no letters. A character that is not a letter simply remains in place upon encoding. An uppercase letter is encoded as a pair of uppercase letters, and a lowercase letter as a pair of lowercase letters. The message

One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen!

is for example encoded as

NPmodf, RVuymq, QWekoubhbh, BJksqynv, AKdnqazj, MYcord, LZxlocxlgu, WMaqyozplb, EWzrewvn, JDuodx, TPawtpkgtpcy, HFkisqzxjhsq, GGuuvveeggrrrraa, RTacgidffhqsqszb, QUtxqueiptptyc!

where the word One is encoded with distance $$n=1$$ as NPmodf, the word Two with distance $$n=2$$ as RVuymq, the word Three with distance $$n=3$$ as QWekoubhbh, ..., and the word Fifteen with distance $$n=15$$ as QUtxqueiptptyc.

Assignment

Example

>>> jump('V', 7)
'C'
>>> jump('v', -7)
'o'
>>> jump('!', 13)
Traceback (most recent call last):
AssertionError: invalid letter: !

>>> reflection('V', 1)
'UW'
>>> reflection('v', 7)
'oc'
>>> reflection('!', 13)
Traceback (most recent call last):
AssertionError: invalid letter: !

>>> fixation('UW', 1)
'V'
>>> fixation('oc', 7)
'v'
>>> fixation('cm', 4)
Traceback (most recent call last):
AssertionError: invalid pair: cm

>>> encode('One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen!')
'NPmodf, RVuymq, QWekoubhbh, BJksqynv, AKdnqazj, MYcord, LZxlocxlgu, WMaqyozplb, EWzrewvn, JDuodx, TPawtpkgtpcy, HFkisqzxjhsq, GGuuvveeggrrrraa, RTacgidffhqsqszb, QUtxqueiptptyc!'
>>> encode('And Now for Something Completely Different')
'ZBmoce LPmquy cilrou OWksiqaipxdlemjrck XHjthrkugqzjoyzjgqtd XJcozlzlyklxykhtnz'

>>> decode('NPmodf, RVuymq, QWekoubhbh, BJksqynv, AKdnqazj, MYcord, LZxlocxlgu, WMaqyozplb, EWzrewvn, JDuodx, TPawtpkgtpcy, HFkisqzxjhsq, GGuuvveeggrrrraa, RTacgidffhqsqszb, QUtxqueiptptyc!')
'One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Eleven, Twelve, Thirteen, Fourteen, Fifteen!'
>>> decode('ZBmoce LPmquy cilrou OWksiqaipxdlemjrcm XHjthrkugqzjoyzjgqtd XJcozlzlyklxykhtnz')
Traceback (most recent call last):
AssertionError: invalid pair: cm

Epilogue

Nárkissos (Ancient Greek: Νάρκισσος) or Narcissus (Latin) is a character from Greek mythology. He was a son of the river god Cephissus5 and the nymph Liriope6. The most popular account of Narcissus is by Ovid7, who passed on the Greek myth as a poem in Latin (Metamorphoses 3.341-510). Ovid's version tells the story from the metamorphosis of the nymph Echo to the metamorphosis of Narcissus.

narcissus
Narcissus by Jan Cossiers (17th century).

Narcissus was a hunter from Thespiae8 in Boeotia9 who was known for his beauty. He rejected all romantic advances, eventually falling in love with his own reflection in a pool of water, staring at it for the remainder of his life. After he died, in his place sprouted a flower bearing his name.

The character of Narcissus is the origin of the term narcissism10, a fixation with oneself.