On the Subject of Levenshtein Distance
Close is further than far if you travel by car.
- Two words of lengths 4–8 will be displayed on top two displays.
- There are ten buttons with digits that you can use to type in your answer, which will be displayed on the bottom display. This number cannot have more than two digits.
- There are also three other buttons with labels "SUB" (use to submit your answer), "CLR" (use to clear the bottom display) and "DEL" (use to delete the last digit displayed on the bottom display if there are any).
- Pressing any other button than the one with the label "SUB" will never strike you.
- Pressing the button with the label "SUB" will solve the module if the number displayed on the bottom display is the correct answer.
- The module will always strike if you press the button with the label "SUB" while there's nothing displayed on the bottom display and while the module is not solved yet.
- The module does not reset after striking, the correct answer never changes.
- To calculate the correct answer, follow the steps below.
- First, calculate the Levenshtein Distance of the words displayed on the top two displays. Refer to Appendix Levenshtein Distance for instructions. Call the result LD.
- Multiply LD by the number of batteries present on the bomb if there is at least one. Otherwise, multiply LD by 1. You now have X.
- Then multiply the number of port types with the number of indicators present on the bomb and add this product to X to get Y.
- If the sum of serial number digits contains any digit that is present in the serial number, subtract 1 from Y to get Z.
- The correct answer is the result of moduling the number Y by 100.
- Modulo by 100 is done by repeatedly adding or subtracting 100 until the number is in range from 0 to 99 inclusively.
- You can keep Z for good luck. It is not be needed to solve the module.
- However, if the serial number contains the letters L and D, submit raw LD. You are spared of all the modifications.