﻿ Reverse Polish Notation — Keep Talking and Nobody Explodes Module ## On the Subject of Reverse Polish Notation

5 5+3 3+*9+

On the module there is a big screen in the middle and a small screen below it, three LEDs indicating stage number, keypad with numbers 0-9, submit and clear button as well as a decimal button.

To solve the module, calculate the answer of the displayed equation. This equation is written in different notation. This notation is called Reverse Polish Notation (postfix notation). When you have your answer, take the absolute value of it, modulo it by 1'000'000, round it to 3 places after the decimal point (0.5 rounds up to 1), input it using the keypad and then hit the OK button. You can clear your input using the clear button. Complete all 3 stages to solve the module. When an incorrect answer is entered, you’ll get a strike, but the module won't reset. NOTE: If you have to divide by 0 then let the answer be 0.

### Encoded numbers:

Every number in the equation can be replaced with a letter. Using the rules below for the correct letters obtain the number and replace the correct letter in the equation with it. If the letter returns a 0, add 1 to it.

If the letter is:

A - the product of the number of batteries and the number of modules on the bomb excluding needies.

B - the square of the difference between the number of ports and the number of indicators.

C - number of battery holders plus 2, divided by the last digit of serial number. Drop any remainders.

D - sum of the non-encoded numbers in the current stage plus 10.

E - serial ports plus parallel ports. If the current stage is 1 or 3 multiply by the third character of the serial number, otherwise add the third character of the serial number instead.

F - The nth term of the triangle number sequence where n is equal to the number of port plates plus PS2 and RJ ports mod 9.

G - lunar addition of the number of solvable modules on the bomb and the number of minutes originally on the bomb. NOTE: If the starting time wasnt a whole number of minutes, round down.

### Reverse Polish Notation:

(3 + 5) * (7 - 2) infix notation

3 5 + 7 2 - * postfix notation (RPN)

In the first expression, the brackets tell us that we must add 3 to 5, then subtract 2 from 7, and multiply the two results together. In RPN, the numbers and operators are listed one after another, and an operator always acts on the most recent numbers in the list. The numbers can be thought of as forming a stack, like a pile of plates. The most recent number goes on the top of the stack. An operator takes the appropriate number of arguments from the top of the stack and replaces them by the result of the operation. Reading from left to right, this equation is interpreted as follows:

• Push 3 onto the stack.
• Push 5 onto the stack. The stack now contains (3, 5).
• Apply the + operation: take the top two numbers off the stack, add them together, and put the result back on the stack. The stack now contains just the number 8.
• Push 7 onto the stack.
• Push 2 onto the stack. It now contains (8, 7, 2).
• Apply the - operation: take the top two numbers off the stack, subtract the top one from the one below, and put the result back on the stack. The stack now contains (8, 5).
• Apply the * operation: take the top two numbers off the stack, multiply them together, and put the result back on the stack. The stack now contains just the number 40.