如何正确使用曼布语
_xguagua_Firefly_ · · 闲话
知周所众,邦布只会使用“嗯”和“呢”以及标点符号,并且都是以“嗯”开头。并且,由于邦布是小型机械,基于二进制,并且一个数的高位一定是
同样的,我们将曼布语段按标点符号分开,每一段转为二进制数后再转回 Unicode 字符,来翻译曼布语。
这是翻译至曼布语的 Python 代码:
s = input()
for i in s:
o = bin(ord(i))[2:]
for j in o:
print("嗯" if j == '1' else "呢",end = "")
print("~",end = '')
这是翻译至人类语言的 Python 代码:
import sys
def Convert():
ch,c = sys.stdin.read(1),0
if(ch == "\r" or ch == "\n"):
sys.exit()
while(ch == "嗯" or ch == "呢"):
c = (c * 2) + (ch == "嗯")
ch = sys.stdin.read(1)
return chr(c)
while True:
print(Convert(),end = "")
好了看完以上内容你就可以尝试和朋友使用曼布语交流了。
P.S. 这不能和邦布交流因为邦布的邦布语不是这种规则