[Question]
  [
Write a program or function that draws a mountain range, where each subsequent larger mountain peak is "behind" the ones in front, and alternates which side is visible.
This is a mountain range of size `1`
```
/\
```
This is a mountain range of size `2`
```
 /\
/\ \
```
This is a mountain range of size `3`
```
  /\
 / /\
/ /\ \
```
This is a mountain range of size `4`
```
   /\
  /\ \
 / /\ \
/ /\ \ \
```
This is a mountain range of size `5`
```
    /\
   / /\
  / /\ \
 / / /\ \
/ / /\ \ \
```
And so on.
### Input
A single positive integer [in any convenient format](http://meta.codegolf.stackexchange.com/q/2447/42963), `n > 0`.
### Output
An ASCII-art representation of the mountain range, following the above rules. Leading/trailing newlines or other whitespace are optional, provided that the peaks line up appropriately.
### Rules
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so all usual golfing rules apply, and the shortest code (in bytes) wins.
  
[Answer]
## [Charcoal](http://github.com/somebody1234/Charcoal), 16 bytes
```
ＮλＦλ«Ｐ↘⁻λι←↙¹‖Ｔ→
```
[Try it online!](http://charcoal.tryitonline.net/#code=77yuzrvvvKbOu8Kr77yw4oaY4oG7zrvOueKGkOKGmcK54oCW77y04oaS&input=NQ)
### How?
`Ｎλ` inputs the size of the largest mountain into `λ`. `Ｆλ«` runs a loop over values of `ι` from `0` through `λ-1`. (The closing `»` is implied at the end of the program.)
Inside the loop, `Ｐ↘⁻λι` calculates `λ-ι` and draws, without moving the cursor afterward, a line of that length going southeast. Based on its direction, this line will consist of `\` characters. `←` moves one step to the west, and `↙¹` draws a line of length 1 going southwest (made of `/`). Finally, `‖Ｔ→` horizontally reflects the drawing, transforming characters as appropriate: `\` becomes `/` and `/` becomes `\`.
Adding the dump instruction `Ｄ` at the beginning of the loop ([try it](http://charcoal.tryitonline.net/#code=77yuzrvvvKbOu8Kr77yk77yw4oaY4oG7zrvOueKGkOKGmcK54oCW77y04oaS&input=NQ)) allows us to see the progression:
```
    /\
   /  
  /   
 /    
/     
    /\    
   /\ \   
  /    \  
 /      \ 
/        \
    /\    
   / /\   
  / /\ \  
 / /    \ 
/ /      \
    /\    
   /\ \   
  / /\ \  
 / /\ \ \ 
/ /    \ \
    /\    
   / /\   
  / /\ \  
 / / /\ \ 
/ / /\ \ \
```
[Answer]
# JavaScript (ES6), 75 bytes
```
for(n=prompt(s="/\\");n--;s=n%2?s+' \\':'/ '+s)console.log(" ".repeat(n)+s)
```
The full program is currently slightly shorter than the recursive function:
```
f=n=>n?" ".repeat(--n)+`/\\
`+f(n).replace(/\S.+/g,x=>n%2?x+" \\":"/ "+x):""
```
[Answer]
## Python 2, 67 bytes
```
n=input()
s='/\\'
while n:n-=1;print' '*n+s;s=['/ '+s,s+' \\'][n%2]
```
Prints line by line, accumulating the string `s` by alternately adding a slash to the left or right based on the current parity of `n`. Prefixes with `n` spaces. 
An alternative way to update was the same length:
```
s=n%2*'/ '+s+~n%2*' \\'
s=['/ '+s,s+' \\'][n%2]
```
A recursive method was longer (70 bytes).
```
f=lambda n,s='/\\':n*'_'and' '*~-n+s+'\n'+f(n-1,[s+' \\','/ '+s][n%2])
```
[Answer]
## Haskell, 77 bytes
```
0%_=""
n%s=(' '<$[2..n])++s++'\n':(n-1)%(cycle[s++" \\","/ "++s]!!n)
(%"/\\")
```
Usage:
```
putStrLn $ f 5
    /\
   / /\
  / /\ \
 / / /\ \
/ / /\ \ \
```
Prints line by line, accumulating the string s by alternately adding a slash to the left or right based on the current parity of n. Prefixes with n-1 spaces.
[Answer]
## Batch, 202 bytes
```
@echo off
set/af=%1^&1
set m=/\
set s=
for /l %%i in (2,1,%1)do call set s= %%s%%
for /l %%i in (2,1,%1)do call:l
:l
echo %s%%m%
set s=%s:~1%
set/af^^=1
if %f%==1 (set m=%m% \)else set m=/ %m%
```
Takes input as a command-line parameter. Falls through to execute the last loop.
[Answer]
# Ruby, 61 bytes
A pretty straightforward port of [ETHproductions' JavaScript answer](https://codegolf.stackexchange.com/a/98595/11261).
```
->n{s="/\\"
(puts" "*n+s
s=n%2>0?s+" \\":"/ "+s)until 0>n-=1}
```
See it on repl.it: <https://repl.it/EPU5/1>
## Ungolfed
```
->n{
  s = "/\\"
  ( puts " "*n+s
    s = n%2 > 0 ? s+" \\" : "/ "+s
  ) until 0 > n -= 1
}
```
[Answer]
# Haskell, ~~117 107 105 97~~ 90 bytes
```
b!1=["/\\"]
b!n|m<-(1-b)!(n-1)=map(' ':)m++[[("/ "++),(++" \\")]!!b$last m]
(unlines.(1!))
```
[Try it on Ideone.](http://ideone.com/oGrdB4)
Edit: Saved 8 bytes with an idea from Neil.
Ungolfed version:
```
p b 1 = ["/\\"]
p b n = let m = p (1-b) (n-1)
            k = last m
            r = map (' ':) m
        in if b == 1
           then r ++ [k ++ " \\"]
           else r ++ ["/ " ++ k]
f n = unlines(p 1 n)
```
Recursive approach. The shape for `n` is generated by adding a space in front of each line of the `n-1` shape and taking the last line of `n-1` and add `"/ "` before if `n` is odd or `" \"` after if `n` is even ... or so I thought before noticing that this last step is reversed for all recursive steps when the final `n` is odd. Therefore a flag `b` is passed which alternates each recursive call and determines if the next mountain part is added left or right.
[Answer]
# Java 7,130 bytes
```
String f(int n,String s){String l="";for(int i=1;i++<n;l+=" ");return n>1?n%2<1?l+s+"\n"+f(--n,s+" \\"):l+s+"\n"+f(--n,"/ "+s):s;}
```
# Ungolfed
```
class Mountain {
 public static void main(String[] args) {
    System.out.println(f( 5 , "/\\" ) );
  }
 static String f(int n,String s){
    String l = "";
    for (int i = 1; i++ < n; l += " ") ;
      return n > 1? n % 2 < 1?l + s + "\n" + f(--n , s + " \\")
                           :l + s + "\n" + f(--n , "/ " + s)
                            :s;
    }
}
```
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 7 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
Ｈ＼║ｎ↔｝↕
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjI4JXVGRjNDJXUyNTUxJXVGRjRFJXUyMTk0JXVGRjVEJXUyMTk1,i=NQ__,v=8)
I guess Canvas is now the ideal language for this challenge.
[Answer]
# C++ 138(function)
Function :-
```
#define c(X) cout<<X;
#define L(X,Y) for(X=0;X<Y;X++)  
void M(int h){int l=1,r=1,j,H=h,i;L(i,h){for(j=H;j>0;j--)c(" ")L(j,l)c(" /")L(j, r)c("\\ ")c("\ n")(h%2)?(i%2)?r++:l++:(i%2)?l++:r++;H--;}  
```
Full program :-
```
#include<conio.h>
#include<iostream>
using namespace std;
#define c(X) cout<<X;
#define L(X,Y) for(X=0;X<Y;X++)
void M(int h)
{
    int l=1,r=1,j,H=h,i;
    
    L(i, h)
    {
        for (j = H;j > 0;j--)
            c(" ")
        L(j, l)
            c(" /")
        L(j, r)
            c("\\ ")
        c("\n")
        
        (h % 2) ? (i % 2) ? r++ : l++ :(i % 2) ? l++ : r++;
        H--;
    }
}
int main()
{
    int h;
    cin >> h;
    M(h);
    _getch();
    return 0;
}  
```
**NOTE :** the function `_getch()` may have different prototype names across different compilers.
]