Revision 4db4c18c-ac2c-44c9-9c5a-f993bd125bfc - Code Golf Stack Exchange

#[Dyalog APL](https://dyalog.com/download-zone.htm), 63 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319)
<!-- language-all: lang-apl -->
`s@(n+11 9∘○¨+0円j1*⊃¨,⍨\(8∘≠⍴¨⊢)0,'rdluRDLU'⍳¯1↓s)⍴∘'',⍨2×n←≢s←⍞`

uses `⎕IO←0` and features from v16 (`@`)

`n←≢s←⍞` raw input `s` and its length `n`

`⍴∘'',⍨2×n` create a 2n by 2n matrix of spaces

`s@(...)` amend the matrix with the characters of `s` at the specified (pairs of) indices

how the indices are computed:

`¯1↓s` drop the last char of `s`

`'rdluRDLU'⍳'` encode `'r'` as 0, `'d'` as 1, etc; other chars as 8

`0,` prepend a 0

`(8∘≠⍴¨⊢)` turn every 8 into an empty list, all others into a 1-element list

`,⍨\` cumulative swapped concatenations (`abcd` -> `a ba cba dcba`)


`⊃¨` first from each

`0j1*` imaginary constant i to the power of

`+\` cumulative sums

`11 9∘○¨` real and imaginary part from each; get coords in the range `-n`...`n`

`n+` centre them on the big matrix

AltStyle によって変換されたページ (->オリジナル) /