Created
April 15, 2022 18:02
-
-
Save mlliarm/a57e3799ec92d46221cdef2240b3bf2a to your computer and use it in GitHub Desktop.
Obfuscated python for the Game of Life
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit to `oskar31415` from the r/APLjk discord server for sharing the code and his friend for writing it. | |
''' | |
Original code: | |
(lambda N,P:(lambda f,i:P.show(__import__('matplotlib.animation',fromlist=['FuncAnimation']).FuncAnimation(f,lambda i:[i.set_array((lambda g:(lambda n:N.logical_or(n==3,N.logical_and(g,n==2)))((N.sum([N.roll(N.roll(g,y,1),x,0)for x in(-1,0,1)for y in(-1,0,1)if x|y],0))))(i.get_array())),[i]][1],interval=0,blit=1)))(P.figure(),P.imshow(N.random.rand(200,400)<.2,)))(__import__("numpy"),__import__("matplotlib.pyplot")) | |
''' | |
# Expanded by mlliarm@ | |
import pdb | |
try: | |
import matplotlib.pyplot as P | |
import numpy as N | |
(lambda N,P:(lambda f,i:P.show( | |
__import__('matplotlib.animation',fromlist=['FuncAnimation']).FuncAnimation( | |
f,lambda i:[i.set_array( | |
(lambda g:( | |
lambda n:N.logical_or( | |
n==3,N.logical_and(g,n==2) | |
) | |
)( | |
(N.sum( | |
[N.roll(N.roll(g,y,1),x,0)for x in(-1,0,1)for y in(-1,0,1)if x|y],0 | |
)) | |
))(i.get_array()) | |
),[i]][1], | |
interval=0,blit=1) | |
))(P.figure(),P.imshow( | |
N.random.rand(200,400)<.2, | |
)))#(__import__("numpy"),__import__("matplotlib.pyplot")) | |
print('works?') | |
except Exception: | |
pdb.post_mortem() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment