Its modern descendent are https://en.wikipedia.org/wiki/J_(programming_language) & https://en.wikipedia.org/wiki/K_(programming_language).
The opaque one-liner:
using IterTools,ImageInTerminal,Colors;for g in iterated(a->let n=sum(map(t->circshift(a,t),product(-1:1,-1:1)));(a.&(n.==4)).|(n.==3);end,rand(Bool,(99,99)));imshow(map(Gray,g));print("\n\n");end
The legible version where we give everything descriptive names so it's not cryptic and mysterious:
using ImageInTerminal,Colors #the APL demo also uses a library for pretty display
using IterTools #okay *technically* this is a minor cheat
function nextgen(grid)
neighborcount = sum(map((t)->circshift(grid,t), product(-1:1,-1:1)))
return (grid .& (neighborcount .== 4)) .| (neighborcount .== 3)
end
function animate(grid)
for gen in iterated(nextgen, grid)
imshow(map(Gray, gen))
print("\n\n")
sleep(0.05)
end
end
animate(rand(Bool,(100,100)))