# Draw the lambda blazon

To celebrate the 2497th anniversary of the Greek victory at Salamis in 480 BC. Draw the lambda blazon.

The lambda blazon was the lambda painted on greek shields like so: Puzzle: Given a positive odd integer n, produce an ascii art image of the above shield.

Specifications:

n=1:

( /\ )


n=3:

(   /\   )
|  /  \  |
( /    \ )


n=5

(     /\     )
|    /  \    |
|   /    \   |
|  /      \  |
( /        \ )


Graph: n=3

          2|   (   /\   )
y-axis    1|   |  /  \  |
0|   ( /    \ )
___________
0123456789

x-axis


Description:

There should be exactly n \ characters and n / characters. The /s and \s should not touch the edge of the shield. The bottom and top corners of the shield will be denoted with a ( or ) unless n=1 where there will be one ) and one (. There will always be one space between the bottom corners and the lambda, increasing by 1 with the y axis until y + 1 == n. Non corners of the shield side will be denoted with |. There is no shield top.

• Why downvote? (2 more to go) – user202729 Oct 20 '17 at 15:19
• @user202729 what do you mean 2 more to go? – jacksonecac Oct 20 '17 at 15:28
• SE has comment character restriction, which force comments to be at least 15 characters. – user202729 Oct 20 '17 at 15:29
• Why couldn't you have waited 3 years to post it for the 2.5k'th anniversary ;-; – HyperNeutrino Oct 20 '17 at 16:38
• Why only odd integers? :o – Felix Palmen Oct 20 '17 at 17:37

# Charcoal,  17  13 bytes

Thanks to @Neil for saving 4 bytes!

(↙↓⊖θＭ↑(→↗Ｎ‖Ｍ


Try it online!

Explanation:

(↙                // Print '(' and move one step down and to the left.
↓⊖θ             // Print n-1 '|'s downwards.
Ｍ↑          // Move one step up.
(→        // Print '(' and move one step to the right.
↗Ｎ      // Print n '/'s towards the upper right corner.
‖Ｍ    // Mirror the left half to produce the right half.

• ⊖ saves you a byte, and half of your Ｍs are unnecessary. – Neil Oct 20 '17 at 16:06
• Also, your Ｉθ can be Ｎ to save another byte. – Neil Oct 20 '17 at 16:12
• Summing up Neil's suggestions, 13 bytes – Mr. Xcoder Oct 20 '17 at 16:21
• @Mr.Xcoder Thanks, but I got around to doing those already. – Steadybox Oct 20 '17 at 16:24
• It's small, but I believe in your explanation (→ should mean "... and move one step to the right" – Kamil Drakari Oct 20 '17 at 18:35

# SOGL V0.12, 17 14 bytes

┐*ƨ(Κm«@.╚┼┼╬³


Try it Here!

Explanation:

example input: 3
┐*              push a string of input amount of "|"                      "|||"
ƨ(            push "("                                                  "|||", "(("
Κ           prepend that to the vertical bar string                   "((|||"
m          mold that string as the input (remove excess characters)  "((|"
«         put the first character at the end                        "(|("
@        push a space                                              "(|(", " "
.╚      create a diagonal of input length                         "(|(", " ", ["  /", " / ", "/  "]
┼┼    append those three horizontally together                  ["(   /", "|  / ", "( /  "]
╬³  palindromize that all


# C (gcc), 103 96 bytes

f(n,j,b){for(j=n;j--;printf("%c%*c%*c%*c\n","|("[b],j+2,47,n+n-j+~j,92,j+2,"|)"[b=j<1|n-2<j]));}


Try it online!

• We excuse the main and includes now? This community has changed. – Alec Teal Oct 21 '17 at 14:34
• @AlecTeal It is acceptable to write a function that performs the specified task rather than a full program. Includes in general do count towards the byte count, some C compilers, however, attempt to guess a function definition if no matching includes are present. – Jonathan Frech Oct 21 '17 at 14:45
• Think you crossed out the wrong number, chief – Veskah Jan 18 '19 at 0:45
• @Veskah True. ._. – Jonathan Frech Jan 18 '19 at 18:37

# Retina, 41 bytes

.+
$* ($'/$$$' )¶ G. sT()|¶.*¶  Try it online! Explanation: .+ *  Convert to unary, but using spaces.  ( '/$' )¶


Use the match prefix and suffix operators to generate a series of lines with increasing amounts of centre space on each line.

G.


However, there's an extra blank line, which throws off the final transliteration, so delete it here.

sT()|¶.*¶


On all lines except the first and last, change the ()s to |s.

# Perl 5, 91 + 1 (-p) = 92 bytes

$_='('.($s=$"x($q=$_))."/\$s)";while(--q){say;y/()/|/;s| /|/ |;s|\\ | \\|}s/\|/(/;s/\|/)/  Try it online! # Java (OpenJDK 8), 200190 170 bytes n->{for(char i=0,s[];i<n;s[-~n-i]=47,s[2+n+i]=92,s=i<1|i>n-2?40:'|',s[3+n+n]=i<1|i++>n-2?41:'|',System.out.println("".valueOf(s).replace('\0',' ')))s=new char[4+n+n];}  Try it online! # Pyth, 43 bytes This is quite gigantic given that it's been done on mobile :-/ j_m++++++@"(|"J!/,1QdK*;d\/*;y-Qd\\K@")|"JS  Try it online! # Python 2, 85 bytes n=a=input() while a:print'(|'[1<a<n]+a*' '+'/'+(n-a)*' '+'\\'+a*' '+')|'[1<a<n];a-=1  Try it online! # R, 153 bytes function(n){s=2*n+4 m=matrix('|',s,n) m[3:s-1,]=' ' m[cbind(5:s-2,c(n:1,1:n))]=1 m[1,c(1,n)]='(' m[s,c(1,n)]=')' m[m>0]=rep(c('/','\\'),n) rbind(m,'\n')}  Try it online! ## Batch, 218 bytes @echo off set s= for /l %%i in (1,1,%1)do call set s= %%s%% set s=%s%/\%s% echo (%s%) for /l %%i in (2,1,%1)do call:l %1 %%i exit/b :l set s=%s: /=/ % set s=%s:\ = \% if %1==%2 (echo ^(%s%^))else echo ^|%s%^|  As if |s weren't bad enough, ()s don't work well with if...else. # 05ab1e (27 bytes) F"|("0NQ¹<NQ~èð¹N-×'/ðN×J∞,  try it online explanation F #Loop n times |("0NQ¹<NQ~è #Use ( or | ð¹N-× #put spaces (1) '/ #put / ðN× #put more space J∞, #reverse image  • I think '/¹N-ú is a byte shorter than ð¹N-×'/. – Neil Oct 23 '17 at 9:43 • Nice approach, but there are a few things to golf. One is what @Neil suggested above. In addition: "|(" can be „|( (there are builtins for 1, 2, and 3-char strings being ', „ and … respectively); and 0NQ¹<NQ~ can be Î‚Nåè (Î seems to be bugged in the legacy version of TIO, but it does work in the latest version of 05AB1E, in which case you'll also have to replace ∞ with º). So in total (21 bytes): F„|(Î‚Nåè'/¹N-úðN×Jº, Try it online. – Kevin Cruijssen Jan 18 '19 at 12:18 # Funky, 101 bytes n=>for(i=0;i<n;i++)print(((c=(i==n-1)or!i)?"(":"|")..(s=" "*n-i).."/"..(" "*i*2).."\\"..s..c?")":"|")  Try it online! # Python 2, 90 bytes n=input() for i in range(n):m=-~i%n<2;s=' '*(n-i);print'|('[m]+s+'/'+' '*i+'\\'+s+'|)'[m]  Try it online! -1 thanks to ovs. • fails for n=1, but can be fixed by replacing i%~-n<1 with -~i%n<2 – Rod Oct 20 '17 at 15:27 • @Rod thanks, fixed – Erik the Outgolfer Oct 20 '17 at 15:28 • 90 bytes: '<space>'*i*2 -> '<space><space>'*i – ovs Oct 20 '17 at 15:55 • @ovs @_@ why didn't I think of that – Erik the Outgolfer Oct 20 '17 at 15:59 # C# (.NET Core), 188 bytes n=>{int y=0,i=-1;var s="";while(y<n){var r=new char[n*2+4];r[n+1-y]='/';r[n+2+y]='\\';if(y<2|y++>n-2)i++;r="(|("[i];r[n*2+3]=")|)"[i];s+=new string(r)+"\n";}return s.Replace("\0"," ");}  Try it online! ### Degolfed n=>{ int y=0,i=-1; var s=""; while(y<n){ var r=new char[n*2+4]; r[n+1-y]='/'; r[n+2+y]='\\'; if(y<2 | y++>n-2) i++; r = "(|("[i]; r[n*2+3] = ")|)"[i]; s += new string(r)+"\n"; } return s.Replace("\0"," "); }  # Python 3, 110 bytes 93 bytes b=c=int(input())*2 d,e='/\\' while b:print('(|%%ss)|'[2<b<c::2]%f' {d+e:^{c}} ');d+=' ';b-=2  # PowerShell, 939190 89 bytes -2 Thanks to ASCII-only for pointing out extra parens -1 Thanks to Mazzy for tweaking swap logic param(n)0..--n|%{"|("[!(x=(n-_)*_)]+(y=" "*(n-_+1))+"/"+" "*_+"$y"+"|)"[!$x]}


Try it online!

Trying to tweak that $x= bit. There's probably a smarter way to get the 1st and last line out in a few less bytes. There is a better $x= but it isn't much cheaper.

# Canvas, 12 bytes

┤|×(ｅ⟳ ＋╴／＋║


Try it here!

Explanation:

┤             decrease the input by 2
|×           repeat "|" vertically - if the amount is -1 (for input of 1), ir just removes the item currently
(          push "("
ｅ        encase in that parentheis - if that first string isn't there, currently it just fails doing anything and leaves the parenthesis on the stack
⟳       rotate clockwise
＋     append horizontally a space
╴／   get a diagonal the length of the input
＋  append it horizontally to the current result
║  and palindromize horizontally with 0 overlap