Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Walk the words!

It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words!

Walking words

Walking words are words which will respond to certain characters. For the purpose of this challenge the trigger characters are [u, d, r, l] from up down right left.

Whenever you encounter such a character when printing text, you will move the direction of the text.
For example, the text abcdef will result in:

abcd
 e
 f

Rules

  • Both uppercase UDRL and lowercase udrl should change the direction, but case should be preserved in the output
  • Input will only contain printable characters (0-9, A-Z, a-z, !@#%^&*() etc...), no newlines!
  • Whenever the text will collide, it will overwrite the old character at that position
  • Output should be presented to the user in any fashionable matter, but it should be a single output (no array of lines)
  • Trailing and leading newlines are allowed
  • Trailing spaces are allowed
  • Standard loopholes apply

Test cases

empty input => empty output or a newline
u =>
u
abc =>
abc
abcd =>
abcd
abcde =>
abcd
 e
abcdde =>
abcd
 d
 e
codegolf and programming puzzles =>
 cod
 e
 g
 o
dna fl sel
 z
p z
rogramming pu
ABCDELFUGHI =>
 I
AHCD
 G E
 UFL
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words! =>
dnats taht noinipo el
a b
rd m
 It is in my hu
 t
 e
 x
 t
 i
 s
 b
 o
 ring. Therefore I propose a new writing stand
 a
 rd
 ,
 w
 a
 rdw gnikl
 s
 !

This is , shortest code in bytes wins!

Answer*

Draft saved
Draft discarded
Cancel
1
  • 1
    \$\begingroup\$ @Veskah The was supposed to be a No. Sorry about that. \$\endgroup\$ Commented May 24, 2019 at 17:14

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