Hexagony, 37 bytes (Side Length 4)
? } , $
; } < . .
0 ~ \ > ( <
/ , < } . > /
> ; / @ \ '
$ ' 6 5 ;
\ 9 4 \
Input is of the form: "[number] [string]"
3 Hello World!
In terms of pictures, I've split it up into:
Most of the program, and the End
`?}` gets the pointer num and moves the MP
`,` skips the space
`$` creates a jump to the for loop
Red / Orange
`,` gets the next byte from stdin
`<` goes out of loop if byte is <= 0
`;` prints the byte
`~0` when Hexagony reads an empty byte, it puts a -1 in memory,
I then flip that to 1 and append a 0 to get 10
This saves 1 char over `*10` which I needed to save
`;` prints the newline
`56` appends a 56 to the 10 to get 1056
taken modulo 256, it comes out to 32 which is ascii
for space; this also saves 1 char over `*32`
`'` moves the MP back to the pointer num
`$` jumps into the space printing loop
Green / Blue
`(` decrements by 1 before checking if 0 so that it
prints pointer val - 1 spaces
`<` loops if counter > 0
`};'` moves to the memory value containing the space,
prints it, then moves back
`}'` the `'` was already in the path, so I used } to move it forward
so it would move back
`94` puts ascii `^` into memory
Starting from where purple left off, I was lucky that the program basically worked itself out. It ends up not changing the 94 in memory until it prints it, and then eventually makes its way to a blank space that hadn't been used and so I put the stopping point there and it all worked out. Fun challenge!
Try it online!