小编Cai*_*irn的帖子

Python - 有些人可以向我解释这个代码吗?

我在StackExchange上看到了这个代码用于ASCII空间入侵者,并且想要尝试理解它背后的概念.如果有人有几分钟时间向几周前开始的人指出关键概念,我们将不胜感激!

    exec'''import threading as t
    import msvcrt,Queue,time,random,os
    u=raw_input('name:')
    r=range
    @Z:
    $~(S):S.w=78;S.h=30;S.X();S.l='';S.Q=[];S.q=[];S.m=''
    $J(S,x,y,c):S.q.append([x,y,c])
    $X(S):S.s=[[' '^y in r(78)]^x in r(30)]
    $V(S):
    ?s='';S.X()
    ?^x,y,z in S.q:S.s[y][x]=z
    ?S.q=[]
    ?^x in S.s:
    ? ^y in x:s+=y
    ? s+='\\n'
    ?s+=S.m.center(S.w)
    ?if s!=S.l:os.system('cls');S.l=s;print s
    @E(Exception):pass
    @C:
    $~(S,g,c,p):S.g=g;S.c=c;S.p=p;S.s=[]
    $M(S,a,d):
    ?if (a<0 and S.p[d]==0) or (a>0 and S.p[d]==(S.g.z.h if d else S.g.z.w)-1):raise        
    E()
    ?S.p[d]+=a
    $X(S):S.s.remove(S)
    @A(C):
    $~(S,g):C.~(S,g,'A',[39,28])
    $M(S,a,d=0):
    ?try:C.M(S,a,d)
    ?except E:pass
    @Y(A):
    $~(S,g,p):C.~(S,g,'Y',p);S.s=g.a
    @B(C):
    $~(S,g,p,n):C.~(S,g,'|'if n<0 else'*',[p[0],p[1]+n]);S.s=g.b;S.d=n;S.a=0 if n<0         
    else 1
    $M(S):
    ?try:C.M(S,S.d,1)
    ?except E:S.X()
    $b(S):S.g.z.J(S.p[0],S.p[1],'X');S.g.z.V();S.X()
    $co(S):
    ?^w in …
Run Code Online (Sandbox Code Playgroud)

python ascii

0
推荐指数
1
解决办法
185
查看次数

标签 统计

ascii ×1

python ×1