# A riddle and a line of text

I have a bit of pseudocode for you, and then an encoded string. The pseudocode will help you untangle the string. It's not the most easily understood pseudocode, and that might (just might) make your task a little bit harder.

String[] pre to new Preamble[] with void, establish & perform:
use package (alphabet) as al
use package (keyboard) as qwerty

String[] answer to new Function[] with x as parameter, perform:
rename x to ca
set ca to new String[]
~ w/ ca to al.upper[3] & al.lower[indices(3,5,19,5,18)]
set ci to new String[]
~ w/ ci to al.upper[9] & al.lower[indices(13,16,15,19,19,9,2,12,5)]
set ac to new Int[ca.length]
set ic to new Int[ci.length]
return ca if ac < ic else ci

Char[] getChar to new Function[] with void, perform:
set target as new Char[]
~ w/ target to max(min(range(4.25*4,floor(pi**e))),0,1,2,3,-∞)
return target

{EOF}


And then, the code:

WFE3gAk2gbE3d2U3LKsngqHqgbE3fqLjd2U1CbzjfAM6LVDwOXCbfAM1

In order to receive full credit, explain the pseudocode to me and give me the answer.

# Hints

The pseudocode is based off of Python, JavaScript, Java, and C++
The indices function returns its parameters one at a time, for the purpose of its name.
w/ is sometimes used in texting with the same meaning....
For the encoded string, you typically don't see these types of codes without a certain character, given by the getChar function.
The qwerty variable contains all characters on the standard keyboard, and, for reference, this it what it would be: ["ESC","F1","F2",..."F12","INS","DEL","1","2",...,"0","-","=","BCKSPCE","\t","Q","W","E",...,"P","{","}","|","CAPS","A","S","D",...,"L"....] - The characters are capitalized, but there are no shifted characters.
The arrays perform on a 1-based system (i.e. $5$ would be index $3$ of $[9,30,5,2,\infty]$)

• Syntax error. max(min(range(4.25*4,floor(pi**e)),0,1,2,3,-∞,∞/∞): unmatched parenthesis. Jan 3 '15 at 20:08
• @FlorianF Thanks! I've always had trouble with the parenthesis, even in legit coding. Jan 3 '15 at 20:48
• Does it matter what keyboard or qwerty is? You never use them. And I believe indices(3,5,19,5,18) should be indices(1,5,19,5,18). And now you have one parenthesis too much. Jan 4 '15 at 18:31
• 'Standard keyboard': what country / language / layout ?
– A E
Jan 7 '15 at 22:08
• "It's not the most easily understood pseudocode" -- you've mastered the rhetorical device of understatement Jun 29 '15 at 14:47

# Partial answer: interpretation of pseudocode

1. getChar() method:

set target to max(min(range(4.25*4,floor(pi**e))),0,1,2,3,-∞) and returns it.

$$target=max(min(range(4.25*4,floor(pi**e))),0,1,2,3,-∞)$$

$$=max(min(range(4.25*4,floor(pi^e))),0,1,2,3,-∞)$$

** is a python operator, meaning ^

$$=max(min(range(4.25*4,floor(22.4591577184))),0,1,2,3,-∞)$$

floor is a math function that returns the greatest integer smaller than the input

$$=max(min(range(4.25*4,22)),0,1,2,3,-∞)$$

$4.25*4=17$

$$=max(min(range(17,22)),0,1,2,3,-∞)$$

range is a pythn operator that returns the set of all integers between the two inputs

$$=max(min({17,18,19,20,21,22})),0,1,2,3,-∞)$$

minimum of the set is 17

$$=max(17,0,1,2,3,-∞)=17$$

maximum of the numbers is 17

So getChar() returns 17.

1. answer() method:

set ca to al.upper[3] & al.lower[indices(3,5,19,5,18)]

This gives ca = "Cceser", which is likely a misspelling of "Caesar".

set ci to al.upper[9] & al.lower[indices(13,16,15,19,19,9,2,12,5)]

This gives ci = "Impossible".

set ac to new Int[ca.length]

ac is set to the integer ca.length = 6

set ic to new Int[ci.length]

ic is set to the integer ci.length = 10

return ca if ac < ic else ci

6 < 10 so ac < ic. Return ca, or "Caesar".

1. pre() method:

returns the result of answer() and getChar() as the preamble.

As stated before, answer() returns "Caesar" and getChar() returns 17. So pre() returns ["Caesar", 17], likely meaning a Caesar cipher with key 17.

## Some really weird things:

1. qwerty as defined in pre() is never actually used. Perhaps it means the shift is on a keyboard? Then why does the code have both capital and lowercase letters? There are only capital letters in a keyboard.

2. There is {EOF} at the end of the code, which likely means end-of-file. What is its significance?

3. The code has capital letters, lowercase letters, and numbers. How exactly are we going to shift?

• You can't compare arrays. I used a function notation: Int[num] returns an integer length. (I love Red Herrings, BTW.) May 22 '15 at 22:23
• I've made an edit. The code still isn't making much sense though. May 23 '15 at 14:47
• Well, and it has no sense when you decrypt the code given with Caesar Cipher and key 17 May 25 '15 at 12:44
• @AlbertMasclans Yeah I know. I've tried several different ways, which all gave me gibberish. May 25 '15 at 13:38
• It's Ccesser, not Ccessar. Also, the misspelling could possibly relate to solving the cipher. May 30 '15 at 7:52