Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
NOTE: The script should run in Python 3.XX
"""
HINT FROM GAME:
A=11
Z=10
The script uses an integer base and the remainder function (%) to create a mapping that can be used to convert a cypher word into an integer representation needed to open the safe.
Frustratingly, there are TWO working solutions to this problem. Base 26 AND base 13. Both evaluate A as 11 and Z as 10... However, the resulting numbers do not work in practice because they only amount to 6 digits, where the safe requires 8 digits.
BASE 13: 0, 2, 11, 3, 5 (NOT WORKS)
BASE 26: 13, 2, 11, 3, 18 (WORKS)
"""
INTEGER_BASE = 26
VALUE_OF_A = 11
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
b11seq = [
i % INTEGER_BASE
for i in range(VALUE_OF_A, VALUE_OF_A + 26)
]
decoder = dict(zip(alpha, b11seq))
print(decoder)
def decode_letter(ch):
return decoder[ch.upper()]
def decode_phrase(phrase):
for ch in phrase:
print(decode_letter(ch))
# VERIFY THAT THE ASSUMPTIONS ARE TRUE (PROGRAM WILL CRASH IF DECODER FAILS TESTS)
assert decode_letter("a") == 11
assert decode_letter("z") == 10
# DECODE THE PHRASE
decode_phrase("crash")
My girlfriend didn't like how it counts starting at 0, in programming you start counting at 0 in pretty much any language. This fact causes a lot of programmers to run into the infamous "off by 1" when they are noobies. I thought it was interesting that it worked either way for this cypher since it didn't contain the letter P. P can be 0 or 26, it doesn't matter. I didn't want to spend too much time rewriting the code, but here's a tweak that would shift the count from 0:25 to 1:26. It works either way but I thought others might be interested.
INTEGER_BASE = 26
VALUE_OF_A_MINUS_1 = 10
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
b11seq = [
i % INTEGER_BASE + 1
for i in range(VALUE_OF_A_MINUS_1, VALUE_OF_A_MINUS_1 + 26)
]
Doesn't anyone read Graeme Base?