python - 可能的谷歌谜语?

标签 python

我的 friend 得到了这件免费的谷歌网站优化器 T 恤,他来找我试图弄清楚前面的标志是什么意思。

t-shirt

所以,我对它的含义有一些猜测,但我只是想知道是否还有更多内容。

我的第一个猜测是每个 block 代表一个页面布局,而 Logo “你应该测试那个”只是意味着你应该使用谷歌网站优化器来测试哪个是最好的布局。我希望这不是答案,它看起来很简单且不令人满意。

嗯,在过去的一个小时里,我一直在试图找出是否有更深层次的含义,但无济于事。所以,我在这里希望有人能够提供帮助。

虽然我确实写了一个程序来查看这些 block 是否代表二进制形式的东西。我将在下面发布代码。我的代码测试将 block 读取为 4 位的每个排列,然后尝试将这些位解释为字母、十六进制和 IP 地址。

我希望有人知道得更多。

#This code interprets the google t-shirt as a binary code, each box 4 bits.
# I try every permutation of counting the bits and then try to interpret these
# interpretations as letters, or hex numbers, or ip addresses.

# I need more interpretations, maybe one will find a pattern

import string

#these represent the boxes binary codes from left to right top to bottom
boxes = ['1110', '1000', '1111', '0110', '0011', '1011', '0001', '1001']

#changing the ordering
permutations = ["1234", "1243", "1324", "1342", "1423", "1432", 
                "2134", "2143", "2314", "2341", "2413", "2431",
                "3124", "3142", "3214", "3241", "3412", "3421", 
                "4123", "4132", "4213", "4231","4312", "4321"]

#alphabet hashing where 0 = a
alphabet1 = {'0000':'a', '0001':'b', '0010':'c', '0011':'d',
             '0100':'e', '0101':'f', '0110':'g', '0111':'h',
             '1000':'i', '1001':'j', '1010':'k', '1011':'l',
             '1100':'m', '1101':'n', '1110':'o', '1111':'p'}

#alphabet hasing where 1 = a
alphabet2 = {'0000':'?', '0001':'a', '0010':'b', '0011':'c',
             '0100':'d', '0101':'e', '0110':'f', '0111':'g',
             '1000':'h', '1001':'i', '1010':'j', '1011':'k',
             '1100':'l', '1101':'m', '1110':'n', '1111':'o'}

hex       = {'0000':'0', '0001':'1', '0010':'2', '0011':'3',
             '0100':'4', '0101':'5', '0110':'6', '0111':'7',
             '1000':'8', '1001':'9', '1010':'a', '1011':'b',
             '1100':'c', '1101':'d', '1110':'e', '1111':'f'} 

#code to convert from a string of ones and zeros(binary) to decimal number
def bin_to_dec(bin_string):
    l = len(bin_string)
    answer = 0
    for index in range(l):
        answer += int(bin_string[l - index - 1]) * (2**index)
    return answer        

#code to try and ping ip addresses
def ping(ipaddress):
    #ping the network addresses 
    import subprocess

    # execute the code and pipe the result to a string, wait 5 seconds
    test = "ping -t 5 " + ipaddress
    process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE)

    # give it time to respond
    process.wait()

    # read the result to a string
    result_str = process.stdout.read()

    #For now, need to manually check if the ping worked, fix later
    print result_str   

#now iterate over the permuation and then the boxes to produce the codes
for permute in permutations:
    box_codes = []
    for box in boxes:
        temp_code = ""
        for index in permute:
            temp_code += box[int(index) - 1]
        box_codes.append(temp_code)

    #now manipulate the codes using leter translation, network, whatever

    #binary
    print string.join(box_codes, "")

    #alphabet1
    print string.join( map(lambda x: alphabet1[x], box_codes), "")

    #alphabet2
    print string.join( map(lambda x: alphabet2[x], box_codes), "")

    #hex
    print string.join( map(lambda x: hex[x], box_codes), "")

    #ipaddress, call ping and see who is reachable
    ipcodes = zip(box_codes[0:8:2], box_codes[1:8:2])
    ip = ""
    for code in ipcodes:
        bin = bin_to_dec(code[0] + code[1])
        ip += repr(bin) + "."
    print ip[:-1]
    #ping(ip[:-1])
    print
    print

t-shirt .

最佳答案

我给网站优化团队发了邮件,他们说“没有密码,除非你找到密码。:)”

关于python - 可能的谷歌谜语?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/252221/

相关文章:

python - tox/pytest 测试通过/失败取决于主机环境中是否安装了另一个模块

python - Matplotlib 绘制虚线圆圈(使用 plt.plot 而不是 plt.scatter)

javascript - 将 MySQL 数据从 Flask 传递到 JavaScript 以用于 Google Charts

python - 在 pyalsaaudio 上更改声卡

python - 在Python中覆盖文本文件

python - 在 Django 中查询全名

python - 使用 Python 向所有客户端广播 WebSocket

python - 在 Ubuntu 12.04 上安装 Pandas 失败

python - 从数据框列中提取异常

python - 使用 Python Flask 构建渐进式 Web 应用程序