Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) (削除) 20 (削除ここまで) 19 bytes
FS«F⌕rdlu↧ι≔ιω✳∨ωrιFS«FNordlu↧ι≔ιω✳∨ωrι
Try it online! Try it online! Link is to verbose version of code. Explanation:
FS«
Loop over the input characters.
F⌕rdlu↧ιFNordlu↧ι
If the current letter is a direction...
≔ιω
then update the current walking direction.
✳∨ωrι
Print the character in the current walking direction, defaulting to right if no direction has been set yet.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) (削除) 20 (削除ここまで) 19 bytes
FS«F⌕rdlu↧ι≔ιω✳∨ωrι
Try it online! Link is to verbose version of code. Explanation:
FS«
Loop over the input characters.
F⌕rdlu↧ι
If the current letter is a direction...
≔ιω
then update the current walking direction.
✳∨ωrι
Print the character in the current walking direction, defaulting to right if no direction has been set yet.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) (削除) 20 (削除ここまで) 19 bytes
FS«FNordlu↧ι≔ιω✳∨ωrι
Try it online! Link is to verbose version of code. Explanation:
FS«
Loop over the input characters.
FNordlu↧ι
If the current letter is a direction...
≔ιω
then update the current walking direction.
✳∨ωrι
Print the character in the current walking direction, defaulting to right if no direction has been set yet.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) 20(削除) 20 (削除ここまで) 19 bytes
≔rθFS«F⌕rdlu↧ι≔ιθ✳θιFS«F⌕rdlu↧ι≔ιω✳∨ωrι
Try it online! Try it online! Link is to verbose version of code. Explanation:
≔rθ
Initialise the walking direction to horizontal.
FS«
Loop over the input characters.
F⌕rdlu↧ι
If the current letter is a direction...
≔ιθ≔ιω
then update the current walking direction.
✳θι✳∨ωrι
Print the character in the current walking direction, defaulting to right if no direction has been set yet.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) 20 bytes
≔rθFS«F⌕rdlu↧ι≔ιθ✳θι
Try it online! Link is to verbose version of code. Explanation:
≔rθ
Initialise the walking direction to horizontal.
FS«
Loop over the input characters.
F⌕rdlu↧ι
If the current letter is a direction...
≔ιθ
then update the current walking direction.
✳θι
Print the character in the current walking direction.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) (削除) 20 (削除ここまで) 19 bytes
FS«F⌕rdlu↧ι≔ιω✳∨ωrι
Try it online! Link is to verbose version of code. Explanation:
FS«
Loop over the input characters.
F⌕rdlu↧ι
If the current letter is a direction...
≔ιω
then update the current walking direction.
✳∨ωrι
Print the character in the current walking direction, defaulting to right if no direction has been set yet.
Charcoal, (削除) 29 (削除ここまで) 27(削除) 27 (削除ここまで) 20 bytes
≔⊟⟦→⟧θFS«≔§⟦+✳θ⟧⌕rdlu↧ιθ✳θι≔rθFS«F⌕rdlu↧ι≔ιθ✳θι
Try it online! Try it online! Link is to verbose version of code. Explanation:
≔⊟⟦→⟧θ≔rθ
Initialise the walking direction to horizontal.
FS«
Loop over the input characters.
≔§⟦+✳θ⟧⌕rdlu↧ιθF⌕rdlu↧ι
Index into the new direction using the index ofIf the current lowercase letter in the string rdluis a direction. If it matches,..
≔ιθ
then take the direction automatically expanded from + into the four directions, otherwise default toupdate the current walking direction.
✳θι
Print the character in the current walking direction.
Charcoal, (削除) 29 (削除ここまで) 27 bytes
≔⊟⟦→⟧θFS«≔§⟦+✳θ⟧⌕rdlu↧ιθ✳θι
Try it online! Link is to verbose version of code. Explanation:
≔⊟⟦→⟧θ
Initialise the walking direction to horizontal.
FS«
Loop over the input characters.
≔§⟦+✳θ⟧⌕rdlu↧ιθ
Index into the new direction using the index of the current lowercase letter in the string rdlu. If it matches, then take the direction automatically expanded from + into the four directions, otherwise default to the current direction.
✳θι
Print the character in the current walking direction.
Charcoal, (削除) 29 (削除ここまで) (削除) 27 (削除ここまで) 20 bytes
≔rθFS«F⌕rdlu↧ι≔ιθ✳θι
Try it online! Link is to verbose version of code. Explanation:
≔rθ
Initialise the walking direction to horizontal.
FS«
Loop over the input characters.
F⌕rdlu↧ι
If the current letter is a direction...
≔ιθ
then update the current walking direction.
✳θι
Print the character in the current walking direction.