Skip to content

Instantly share code, notes, and snippets.

@headius
Created February 18, 2020 17:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/270b90590078eaa3ea4cf7c18796f3bc to your computer and use it in GitHub Desktop.
Save headius/270b90590078eaa3ea4cf7c18796f3bc to your computer and use it in GitHub Desktop.
Julia set fractal generated using Ruby flip-flops
w, h = 44, 54
c = 7 + 42 * w
a = [0] * w * h
g = d = 0
f = proc do |n|
a[c] += 1
o = a.map {|z| " :#"[z, 1] * 2 }.join.scan(/.{#{w * 2}}/)
puts "\f" + o.map {|l| l.rstrip }.join("\n")
d += 1 - 2 * ((g ^= 1 << n) >> n)
c += [1, w, -1, -w][d %= 4]
end
1024.times do
!!(!!(!!(!!(!!(!!(!!(!!(!!(true...
f[0])...f[1])...f[2])...
f[3])...f[4])...f[5])...
f[6])...f[7])...f[8])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment