Skip to main content
Added b/w implementation
Source Link
agent-j
  • 175
  • 1
  • 6

Here's a coffee-script answer running on node.js:

ascii_mandel_color In black and white:

n='\u001b[0m'
m=(x,y)->
 a=x
 b=y
 z=0
 for i in [0..999]99]
  (return if zi>60 >then 4
'*' else if i>10 then return'-' '\u001b[33m*'+nelse if ii>5 >then 100'.' else ' ') if z>4
  l=y*y
  returnz=x*x+l
 '\u001b[34m-'+n ify=2*x*y+b
 i >x=x*x-l+a
 10'@'
console.log (m x,y for x returnin '\u001b[31m[-1.'+n5..0.5] ifby i2/79).join '' for y in [-1.3..1.3] by 2.6/40

ascii_mandel_color

Adding color:

n='\u001b[0m'
m=(x,y)-> 
 5a=x
 b=y
 z=0
 for i in [0..999]
  (return if i>100 then '\u001b[33m*'+n else if i>10 then '\u001b[34m-'+n else if i>5 then '\u001b[31m.'+n else ' ') if z>4
  l=y*y
  z=x*x+l
  y=2*x*y+b
  x=x*x-l+a
 '\u001b[32m@\u001b[0m'
console.log (m x,y for x in [-1.5..0.5] by 2/79).join '' for y in [-1.3..1.3] by 2.6/40

Here's a coffee-script answer running on node.js:

ascii_mandel_color

n='\u001b[0m'
m=(x,y)->
 a=x
 b=y
 z=0
 for i in [0..999]
  if z > 4
    return '\u001b[33m*'+n if i > 100
    return '\u001b[34m-'+n if i > 10
    return '\u001b[31m.'+n if i > 5
    return ' '
  l=y*y
  z=x*x+l
  y=2*x*y+b
  x=x*x-l+a
 '\u001b[32m@\u001b[0m'
console.log (m x,y for x in [-1.5..0.5] by 2/79).join '' for y in [-1.3..1.3] by 2.6/40

Here's a coffee-script answer running on node.js: In black and white:

m=(x,y)->
 a=x
 b=y
 z=0
 for i in [0..99]
  (return if i>60 then '*' else if i>10 then '-' else if i>5 then '.' else ' ') if z>4
  l=y*y
  z=x*x+l
  y=2*x*y+b
  x=x*x-l+a
 '@'
console.log (m x,y for x in [-1.5..0.5] by 2/79).join '' for y in [-1.3..1.3] by 2.6/40

ascii_mandel_color

Adding color:

n='\u001b[0m'
m=(x,y)-> 
 a=x
 b=y
 z=0
 for i in [0..999]
  (return if i>100 then '\u001b[33m*'+n else if i>10 then '\u001b[34m-'+n else if i>5 then '\u001b[31m.'+n else ' ') if z>4
  l=y*y
  z=x*x+l
  y=2*x*y+b
  x=x*x-l+a
 '\u001b[32m@\u001b[0m'
console.log (m x,y for x in [-1.5..0.5] by 2/79).join '' for y in [-1.3..1.3] by 2.6/40
Source Link
agent-j
  • 175
  • 1
  • 6

Here's a coffee-script answer running on node.js:

ascii_mandel_color

n='\u001b[0m'
m=(x,y)->
 a=x
 b=y
 z=0
 for i in [0..999]
  if z > 4
    return '\u001b[33m*'+n if i > 100
    return '\u001b[34m-'+n if i > 10
    return '\u001b[31m.'+n if i > 5
    return ' '
  l=y*y
  z=x*x+l
  y=2*x*y+b
  x=x*x-l+a
 '\u001b[32m@\u001b[0m'
console.log (m x,y for x in [-1.5..0.5] by 2/79).join '' for y in [-1.3..1.3] by 2.6/40