Explorer les backrooms. Utiliser les flèches pour avancer/reculer et tourner à gauche ou à droite, et les parenthèses pour effectuer un pas de côté.
f='#S$@E' e,V,K,J='$#E.' d=zip c=dict b=range D=int from kandinsky import fill_rect as W,color as L from ion import keydown as G from math import* O=ceil from random import* def M(wall): P=None;A=[[wall]*B for A in b(B)];A[1][1]=A[1][2]=A[1][3]=J;I=[(1,3,0)];E,H,M=P,P,0 while I: F,G,L=I.pop() for O in sorted(range(4),key=lambda x:random()): C,D=[(F+2,G),(F-2,G),(F,G+2),(F,G-2)][O] if 0<=C<B and 0<=D<B and A[C][D]!=J: A[C][D]=A[(C+F)//2][(D+G)//2]=J if L>M and(C in(1,B-2)or D in(1,B-2)):M,E,H=L,C,D I.append((C,D,L+1)) A[1][0]='S' if E==1:A[0][H]=K elif E==B-2:A[B-1][H]=K elif H==1:A[E][0]=K else:A[E][B-1]=K return A def Y(X,Y,angle): R=True;A=angle if A<=-180:A+=360 elif A>180:A-=360 K=float('inf') if A!=0 and A!=180: L=1/T(A);E=A<0;H=D(Y/100)*100 if E else O(Y/100)*100;I=X+(H-Y)*L while R: F,G=H//100-1*E,D(I/100) if not 0<=F<B or not 0<=G<B or C[F][G]!=J:break H+=100*(-1)**E;I+=100*L*(-1)**E K,M=S(X,Y,I,H),R if 0<=F<B and 0<=G<B:N=C[F][G] if A!=90 and A!=-90: P=T(A);E=A>90 or A<-90;I=D(X/100)*100 if E else O(X/100)*100;H=Y+(I-X)*P while R: F,G=D(H/100),I//100-1*E if not 0<=F<B or not 0<=G<B or C[F][G]!=J:break I+=100*(-1)**E;H+=100*P*(-1)**E Q=S(X,Y,I,H) if Q<K: K,M=Q,False if 0<=F<B and 0<=G<B:N=C[F][G] return K,M,N def H(): C=[(0,0,320,222,L(153,156,62)),(0,111,320,111,L(201,205,79))] for D in b(108):G=(D+1)//2*(-1)**D+D%2*108-54;B=A+G*5/9;I,J,K=Y(E,F,B if B%45 else B+0.05);H=round(14000/(I*N(A-B)));M,O,P=[Z,a][J][K];C.append((160+3*G,111-H,3,2*H,L(M,O,P))) for (Q,R,S,T,U) in C:W(Q,R,S,T,U) del C def P(s): global E,F,A,C,I if A%90:return B,G=E-s*100*U(A),F+s*100*N(A) if C[D(G/100)][D(B/100)]==J:E,F=B,G;H() elif C[D(G/100)][D(B/100)]==K:I+=1;C,E,F,A=M(V if I%5 else e),150,150,0;H() def Q(s): global A;A+=s*45 if A<=-180 or A>180:A-=s*360 H() def R(s,c): global E,F,A,C,I if A%90:return B,G=E+s*100*N(A),F+s*100*U(A) if C[D(G/100)][D(B/100)]==J:E,F=B,G;H() elif C[D(G/100)][D(B/100)]==K:I+=1;C,E,F,A=M(c if I%5 else e),150,150,0;H() S=lambda X,Y,x,y:((X-x)**2+(Y-y)**2)**0.5 T,N,U=lambda a:tan(a/180*pi),lambda a:cos(a/180*pi),lambda a:sin(a/180*pi) B=15 C,E,F,A,I=M(V),150,150,0,1 Z=c(d(f,[(238,243,91),(255,0,0),(255,215,0),(206,210,84),(0,238,0)])) a=c(d(f,[(227,232,85),(205,0,0),(205,173,0),(157,160,66),(0,205,0)])) H() while not G(5): if G(33):P(-1) if G(34):P(1) if G(0):Q(-1) if G(3):Q(1) if G(1):R(1,V) if G(2):R(-1,'@')