Carve some ASCII jewels!
Charcoal, 17 bytes
Code:
NβG←β_↙↙¹→↘⁺β¹‖M→
Explanation:
Nβ # Place the input into β
G←β_ # Draw a line of length β with _ as the filling character
↙ # Move the cursor one down and one left
↙¹ # Draw a line from the cursor position to one position ↙
→ # Move the cursor 1 to the right
⁺β¹ # Add one to the input and..
↘ # Create a line pointing ↘, with the size calculated above
‖M→ # Mirror to the right
A very neat command is ‖M
, which also automatically mirrors /
into \
.
Uses the Charcoal encoding.
Try it online!
Python 2, 101 98 95 bytes
lambda n:'\n'.join([' '+'__'*n,'/'+' '*n+'\\']+[' '*i+'\\'+' '*(n-i)+'/'for i in range(n+1)])
Try it Online!
Anonymous function that takes in a positive integer and returns a string
Python 3.6, 92 bytes (Thanks to Ben Frankel)
lambda n:f' {"__"*n}\n/{" "*n}\\\n'+'\n'.join(' '*i+'\\'+' '*(n-i)+'/'for i in range(n+1))
I couldn't find an online interpreter for this version, but it is a bit shorter due to f-strings in v3.6
05AB1E, 27 20 bytes
ƒN·ð×…\ÿ/}¹·'_×)R.c
Try it online!
Explanation
ƒ # for N in range[0 ... n]
N·ð× # push N*2 spaces
…\ÿ/ # push the string "\ÿ/" with "ÿ" replaced by the spaces
} # end loop
 # push a reversed copy of the top of the stack
# (the largest row of the bottom of the diamond)
¹·'_× # push input*2 underscores
) # wrap the stack in a list
R # reverse the list
.c # join the list on newlines, padding each row to equal length