Draw a big slash X

Charcoal, 6 bytes

PX⁺¹NX

Your nonsense ain't stopping me ;)

Try it online!


JavaScript (ES6), 79 bytes

Uses a recursive function g that walks through a grid and builds the output character by character.

n=>(g=x=>`/\\ X
`[~x?x-y?x+y-w&&2:x-n?1:3:4]+(~y?g(~x--?x:y--&&w):''))(y=w=n*2)

How?

Both variables x and y iterate from 2n to -1, where n is the input.

For each position (x, y) in the grid, we pick one of these characters:

  • 0: /
  • 1: \
  • 2: space
  • 3: X
  • 4: newline

using the following tests:

  • ~x: Falsy if x == -1: we've reached an end of line.
  • x-y: Falsy if x == y: we're located on the anti-diagonal.
  • x+y-w: Falsy if x + y == w: we're located on the diagonal.
  • x-n: Falsy if x == n: because this test is only performed when x == y, this means that we're located in the exact center of the grid.

and the following decision tree:

decision tree

Demo

let f =

n=>(g=x=>`/\\ X
`[~x?x-y?x+y-w&&2:x-n?1:3:4]+(~y?g(~x--?x:y--&&w):''))(y=w=n*2)

console.log(f(0))
console.log(f(1))
console.log(f(4))


MATL, 16 bytes

'\/X 'iEQXytEP+)

Try it online!

Consider input 2 as an example. The stack is shown here upside down, i.e. lower elements are the ones most recently pushed.

'\/X '  % Push this string
        %   STACK: '\/X '
iEQ     % Input a number, n. Multiply by 2, add 1: gives 2*n+1
        %   STACK: '\/X '
                   5
Xy      % Identity matrix of that size
        %   STACK: '\/X '
                   [1 0 0 0 0;
                    0 1 0 0 0;
                    0 0 1 0 0;
                    0 0 0 1 0;
                    0 0 0 0 1]
tEP     % Duplicate, multiply each entry by 2, flip vertically
        %   STACK: '\/X '
                   [1 0 0 0 0;
                    0 1 0 0 0;
                    0 0 1 0 0;
                    0 0 0 1 0;
                    0 0 0 0 1]
                   [0 0 0 0 2;
                    0 0 0 2 0;
                    0 0 2 0 0;
                    0 2 0 0 0;
                    2 0 0 0 0]
+       % Add the two matrices
        %   STACK: '\/X '
                   [1 0 0 0 2;
                    0 1 0 2 0;
                    0 0 3 0 0;
                    0 2 0 1 0;
                    2 0 0 0 1]
)       % Index into the string. Indexing is 1-based and modular, so 1 picks
        % the first character ('\'), ..., 0 picks the last (space)
        %   STACK: ['\   /';
                    ' \ / ';
                    '  X  ';
                    ' / \ ';
                    '/   \']
        % Implicit display