Ex Machina 「机械姬」里的小彩蛋

今天在 Netflix 上看了 Ex Machina 「机械姬」这部电影,又是一部与强人工智能「Artificial General Intelligence」相关联、讨论 Consciousness, Self-awarenesses, Mind, Embodiedment 的电影~

话说自从跟着玲做了某项目之后,貌似看到的电影几乎都是关于这些的(((o(*゚▽゚*)o))),仿佛打开了新世界的大门!

不过这篇 post 只是先记录一下在电影中看到的小彩蛋~

当男主 Caleb 决定救出 Ava 的时候,Caleb 拿了 Nathan 的门禁卡去修稿安保程序,然而开了电脑之后却开始拿 Python 3 输入 Sieve of Eratosthenes 算法!(不是,Celeb 你想去救 Ava 我懂,但是你偷了 Nathan 的卡打开了电脑,就是为了拿 Python 写个 Sieve of Eratosthenes 算法求质数吗╮( ̄▽ ̄"")╭

不过蛮好奇有什么输出,于是我等着 Caleb 输入完之后,我照着敲了一遍~代码如下(^O^)

# BlueBook code decryption

import sys

def sieve(n):
# Compute primes using sieve of Eratosthenes
    x = [1] * n
    x[1] = 0
    
    for i in range(2, int(n / 2)):
        j = 2 * i
        while j < n:
            x[j] = 0
            j = j + i
    
    return x

def prime(n, x):
# Find nth prime
    i = 1
    j = 1
    while j <= n:
        if x[i] == 1:
            j = j + 1
        i = i + 1
    return i - 1

# Compute BlueBook unlock code
x = sieve(10000)

code = [1206, 301, 384, 5]
key = [1, 1, 2, 2]

sys.stdout.write("".join(chr(i) for i in [73, 83, 66, 78, 32, 61, 32]))

for i in range(0, 4):
    sys.stdout.write(str(prime(code[i], x) - key[i]))

运行之后的结果如下~(*^3^)

ISBN = 9780199226559

显然是一本书的 ISBN 码!(Caleb 你这是不打算救 Ava、打算转行卖书给 Nathan 了么!)话说编剧给的这个彩蛋还是蛮有意思的~虽然对于程序员来说,一开始看到写 Sieve of Eratosthenes 算法的时候超想吐槽hhhhhh

于是打开了亚马逊查了一下是什么书~

Embodiment and the inner life: Cognition and Consciousness in the Space of Possible Minds

啊,划重点!Embodiedment, Cognition, Consciousness and Minds,看来最近是逃不开这些话题啦 ╮(╯▽╰)╭

Leave a Reply

Your email address will not be published. Required fields are marked *

6 − three =