Skip to main content
Commonmark migration
Source Link

#Octave , 62 58 bytes

Octave , 62 58 bytes

#Octave , 62 58 bytes

Octave , 62 58 bytes

added 96 characters in body
Source Link
rahnema1
  • 5.7k
  • 1
  • 16
  • 22

#Octave , 6262 58 bytes

@(n)' *'(dilate(impad(1,2*--n,n),[k='01010'-48;~k;k],n)+1) 

Previous answer:

#Octave , 62 bytes

#Octave , 62 58 bytes

@(n)' *'(dilate(impad(1,2*--n,n),[k='01010'-48;~k;k],n)+1) 

Previous answer:

Source Link
rahnema1
  • 5.7k
  • 1
  • 16
  • 22

#Octave , 62 bytes

@(n)' *'(dilate(impad(1,2*(m=n-1),m),[k='01010'-48;~k;k],m)+1) 

that can be called as

(@(n)' *'(dilate(impad(1,2*(m=n-1),m),[k='01010'-48;~k;k],m)+1))(5) 

Try (paste) it on Octave Online

For example the base image for n=5 is

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 

that can be created with

impad(1,2*(n-1),n-1) 

The dilation morphological operator applied 4 times on the image using the following neighbor mask:

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 

that can be created with [k='01010'-48;~k;k]

result of dilation:

0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 

then replace 0 and 1 with ' ' and '*' respectively

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *