Skip to main content
Commonmark migration
Source Link

IDL 8.3, 135 bytes

#IDL 8.3, 135 bytes DunnoDunno if this can be golfed more... It's very straightforward. First we create a m x m array (m=2n+1) of empty strings; then, we draw the characters in lines (y=x, y=-x, y=n, and x=n). Then we drop the O in at point (n, n), and print the whole thing, formatted as m strings of length 1 on each line so that there's no extra spacing from printing the array natively.

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \

#IDL 8.3, 135 bytes Dunno if this can be golfed more... It's very straightforward. First we create a m x m array (m=2n+1) of empty strings; then, we draw the characters in lines (y=x, y=-x, y=n, and x=n). Then we drop the O in at point (n, n), and print the whole thing, formatted as m strings of length 1 on each line so that there's no extra spacing from printing the array natively.

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \

IDL 8.3, 135 bytes

Dunno if this can be golfed more... It's very straightforward. First we create a m x m array (m=2n+1) of empty strings; then, we draw the characters in lines (y=x, y=-x, y=n, and x=n). Then we drop the O in at point (n, n), and print the whole thing, formatted as m strings of length 1 on each line so that there's no extra spacing from printing the array natively.

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \
added 346 characters in body
Source Link
sirpercival
  • 1.8k
  • 11
  • 17

#IDL 8.3, 135 bytes Dunno if this can be golfed more... It's very straightforward. First we create a m x m array (m=2n+1) of empty strings; then, we draw the characters in lines (y=x, y=-x, y=n, and x=n). Then we drop the O in at point (n, n), and print the whole thing, formatted as m strings of length 1 on each line so that there's no extra spacing from printing the array natively.

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \

#IDL 8.3, 135 bytes Dunno if this can be golfed more...

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \

#IDL 8.3, 135 bytes Dunno if this can be golfed more... It's very straightforward. First we create a m x m array (m=2n+1) of empty strings; then, we draw the characters in lines (y=x, y=-x, y=n, and x=n). Then we drop the O in at point (n, n), and print the whole thing, formatted as m strings of length 1 on each line so that there's no extra spacing from printing the array natively.

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \
edited body
Source Link
sirpercival
  • 1.8k
  • 11
  • 17

#IDL 8.3, 135 bytes Dunno if this can be golfed more...

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='0'n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----0O----
   /|\   
  / | \  
 /  |  \ 
/   |   \

#IDL 8.3, 135 bytes Dunno if this can be golfed more...

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='0'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----0----
   /|\   
  / | \  
 /  |  \ 
/   |   \

#IDL 8.3, 135 bytes Dunno if this can be golfed more...

pro s,n
m=2*n+1
v=strarr(m,m)
x=[0:m-1]
v[x,x]='\'
v[x,m-x-1]='/'
v[n,x]='|'
v[x,n]='-'
v[n,n]='O'
print,v,f='('+strtrim(m,2)+'A1)'
end

Test:

IDL> s,4
\   |   /
 \  |  / 
  \ | /  
   \|/   
----O----
   /|\   
  / | \  
 /  |  \ 
/   |   \
deleted 2 characters in body
Source Link
sirpercival
  • 1.8k
  • 11
  • 17
Loading
Source Link
sirpercival
  • 1.8k
  • 11
  • 17
Loading