text:
Out Steganograph Me!
Out Steganograph Me
As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them.
The Challenge
Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image as input, and output the string first given.
This should work with any arbitrary string, assuming it is in your chosen character encoding.
You may take input as an array of characters or bytes if it makes it easier, and you may output as a three dimensional array of bytes, or a two dimensional array of hex strings, instead of an image, as well.
Scoring
This is code-challenge, your score will be based on your average score across the test cases.
Individual test cases are scored by taking which of the two dimensions are larger of the output Image, Width or Height, to encourage square instead of lines or rectnagles.
eg, a 5x8 image has a score of 8. A 9x9 has a score of 9, and a 1x30 image has a score of 30.
Lowest Score Wins!
Example for Clarity
A basic algorithm which assigns each UTF-8 Character to each of the RGB channels of an image. so H becomes the r of the first pixel, e becomes the g and so on.

Score 3

Actual:
Expanded:

Score 6

Actual:
Expanded:

Score 4

Actual:
Expanded:

Score 1

Actual:
Expanded:
Average = (3+6+4+1)/4 = 4.6666667
Test Cases

Hello, World!
This was a triumph. I'm making a note here, HUGE SUCCESS! It's hard to overstate my satisfaction.
Multiline
Strings
Usually
Cause
Problems
!

Rules

Standard IO Rules Apply
Standard Loopholes Apply
You may use any form of Character Encoding for your String Input/Output, however, it must support the entire visible range of Ascii, and your programs must support the entirety of it. EG. UTF-8 Must support ► and such.
Control Characters that do not effect the visible output of your string, eg. NUL will not appear in your input.
Predefined Compression or Decompression functions are forbidden, as it defeats the Porpoise of the challenge.
Trailing characters after the decoded output are acceptable, although discouraged.
Have Fun!

Really, portal reference? :P +1 for the porpoise :)

For those not getting the reference

As far as I can tell it's a simple base-conversion task, so [tag:code-challenge] doesn't seem to be appropriate.

Not necessarily, It's a compression task. Trying to fit as much data in an image as possible.

Any specific file format?

Nope, as long as you can get the data back out of it. So probably not Jpeg.

Can we have trailing spaces?

@wat Allowed 'em.

If you want to write a challenge about making the best file compression, you should do that straightforwardly, without a pointless image-based output format. And to create a challenge about compression requires vastly more test data and information about what type of input the program should perform well on.

Does the second program only need to decrypt the files created by the first one? Counter example: I write one image with the first program, open it in an image processing program, save it (unmodified) and the second program cannot read it any more because the image processing program uses a slightly different file header/trailer/compression method/...

Dividing by three and taking a square root is trivial compared to the real challenge here, so this doesn't add anything worthwhile to existing general (i.e. not image, music , etc.) compression questions.

Is the color depth limited? I could search for an image format allowing arbitrary color depths and encode the whole sentence into a color! Then I could encode any sentence into an 1-pixel-image.

Umm. This is NOT a duplicate of the compression challenge. It requires other methods of compression

It is about encoding into an image, not just compressing

With credit to those who've marked it, it is essentially just a Do X but Y problem. However, the people may find it interesting enough to reopen.

Steganography has nothing to do with compression and decompression - it's about hiding the data cleverly.  This challenge is about choosing an image format that allows the fewest number of pixels - not the smallest number of bytes.  @MartinRosenau has the right idea - a one pixel image would win regardless of the size of the image file.  I don't think this is a duplicate of a compression/decompression question.


text:
Golfing Flower of Life
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice.

The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of radius 3 surrounding them.
The design can be scaled as you like, but a max error of 2% from mathematically correct is permitted. If using raster graphics, this effectively limits the diameter of the small circles to at least about 100 pixels.
Since this is code-golf, shortest code (bytes) wins.

Welcome to the site! Just so you know, it's generally encouraged to wait a while before accepting an answer, that way other users won't see the contest as "over", and there will be more participation and competition.

"visual, recognizable, and correct" is neither clear nor objective. It's impossible to determine whether or not a submission is valid without objective validity criteria. We encourage use of the Sandbox to work out any potential issues with challenges before posting them to the main site.

In addition to such abstract rule like “recognizable”, would be better to specify a minimum size.

Since nobody's plugged it yet, we have a sandbox over at the meta that is designed to help new challenges get feedback. You can find it here: http://meta.codegolf.stackexchange.com/questions/2140/sandbox-for-proposed-challenges

It's actually not just 19 circles. There are some circular arcs at the edges as well. (6 of them covering an angle of 2π/3, 12 covering π, 18 covering π/6)

@MartinEnder Yeah, I just reached the point of completing the circles, then I realized I was missing this. It's making me rethink whether it's worth the effort.

Mathematica, 177 173 128 124 120 bytes
c=Circle;Graphics@{{0,0}~c~3,Rotate[Table[If[-3<x-y<4,c[{√3x,-x+2y}/2,1,Pi/{6,2}]],{x,-3,2},{y,-4,2}],Pi/3#]&~Array~6}

The main idea is to compose the result from six rotated versions of this:

This in turn is a rectangular table of identical circle arcs with two corners cut off. If we remove the shearing and represent each circle center with a #, we basically want to distribute the circles in this pattern:
####
#####
######
######
 #####
  ####

These edges are cut off by imposing the condition -3 < x-y < 4 on the 2D indices (since the value of x-y is constant along diagonals) and the shearing comes from multiplying these x and y by non-orthogonal basis vectors which span the grid we're looking for.
This particular orientation of the unrotated arcs turns out to be the shortest since both ends of the arc evenly divide Pi so that the arc can be expressed as Pi/{6,2} (all other arcs would either require and additional minus sign or integers in the numerator).

Use √3 to save 2 characters & 0 bytes, while eliminating a source of numerical error.

@KellyLowder Good point, fixed.

OpenSCAD, 228 bytes
$fn=99;module o(a=9){difference(){circle(a);circle(a-1);}}function x(n)=9*[sin(n*60),cos(n*60)];module q(g){for(i=[1:6])if(g>0){translate(x(i))union(){o();q(g-1);}}else{intersection(){translate(x(i))o();circle(9);}}}q(2);o(27);

The below is a version allowing someone to set parameters r (radius) and w (width of rings).
r=1;w=.1;$fn=99;module o(n){difference(){circle(n);circle(n-w);}}function x(n)=(r-w/2)*[sin(n*60),cos(n*60)];module q(g){for(i=[1:6])if(g>0){translate(x(i))union(){o(r);q(g-1);}}else{intersection(){translate(x(i))o(r);circle(r);}}}q(2);o(3*r-w);

This version is xactly 246 characters.
Some of this code is technically unnecessary but makes it look more like the picture.

I'm getting this error on OpenSCAD.net (Firefox 47):
Error: Error: Parse error on line 1: ...x(k))o();circle(9);};}}}q(2);o(27); -----------------------^ Expecting 'TOK_ID', '}', 'TOK_IF', '!', '#', '%', '*', got ';'

@AlexL. I am not getting that error when I use the actual OpenSCAD client on my mac. However I was able to replicate that error on OpenSCAD.net using chrome, which is disappointing. It think it is an issue on with their service. Could you try the desktop application?

Worked for me on desktop version (Ubuntu 14.04 LTS).

I noticed the pattern };} in your code. I think you could safely replace that with }} which would shave a character for both versions. Tested it myself and seemed to work.

Mathematica, 263 bytes
Not really competitive with @MartinEnder's submission but I had fun with this nonetheless.  I let the petals do a random walk! The petal walks by rotating 60 degrees randomly about one of the endpoints which is also randomly chosen. I test to see if the rotating end of the petal falls outside the large disk, and if so, the rotation goes the other way.
c=Circle;a=√3;v={e=0{,},{0,2}};f=RandomChoice;Graphics@{e~c~6,Table[q=f@{1,2};t=f@{p=Pi/3,-p};r=RotationTransform[#,v[[q]]]&;v=r[If[r[t]@v[[-q]]∈e~Disk~6,t,-t]]@v;Translate[Rotate[{c[{1,a},2,p{4,5}],c[{1,-a},2,p{1,2}]},ArcTan@@(#-#2)&@@v,e],v[[2]]],{5^5}]}

Here is the subsequent code I used for the animation.
Export[NotebookDirectory[]<>"flower.gif", Table[Graphics[Join[{c[e,6]},(List@@%)[[1,2,1;;n-1]],{Thick,Red,(List@@%)[[1,2,n]]}]],{n,1,3^4,1}]]

I read somewhere that 2-dimensional random walks must eventually return to the origin.  It seems like a few thousand steps guarantee filling the large disk.

This is a really nice idea, but with a finite number of iterations there's also a non-zero probability of not filling up the entire flower. You should probably add a termination condition once you've drawn 30 petals (that seems like the shortest way to determine whether you're actually done). Then you'd know the drawing is done when you terminate, and the probability of not terminating would be zero.

Independently of that, there's a lot of bytes you can save: Sqrt[3] is 3^.5. You don't need to define e until its first use and you can use this trick to save a byte on it, so v={e=0{,},{0,2}}. You can also use some infix notation like e~c~6 or e~Disk~6, and ArcTan@@Subtract@@v should be equivalent to ArcTan@@(#-#2)&@@v.

Used infix and also the √ operator to shave off 15 bytes. Thanks for the tips @MartinEnder. Got rid of /2 and 2* which cancelled. There are 180 petals so 4^4 iterations typically covers about half the disk, and 5^5 does the job. The probability of 9^9 not covering the disk is ~ 1 out of 10^400,000 which is much less than 2% error, so not worth the wasted bytes to check.

JavaScript (ES6)/SVG, 299 bytes

with(document){write(`<svg height=250 width=250><circle${b=` fill=none stroke=black `}cx=125 cy=125 r=120 />`);for(i=0;i<24;i++)write(`<path${b}d=M5,125${`${a=`a60,60,0,0,1,`}40,0`.repeat(i%4+3)+`${a}-40,0`.repeat(i%4+3)} transform=${`rotate(60,125,125)`.repeat(i>>2)}rotate(-60,${i%4*4}5,125) />`)}

Works by generating multiple arc pairs of various lengths then rotating them into place.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Score a hand of Hearts
Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score depending on the penalty cards they have taken; the task is to determine the scores under Microsoft Hearts rules.
Input
Input is 4 lists (or delimited string, array, etc.) showing the penalty cards taken by each of the 4 players. The penalty cards are
2♥, 3♥, 4♥, 5♥, 6♥, 7♥, 8♥, 9♥, 10♥, J♥, Q♥, K♥, A♥, Q♠

which we shall represent as
2,  3,  4,   5,  6,  7,  8,  9,  10,  11, 12,  13,  1,  0

respectively.
Output
Output is the 4 penalty points incurred by the 4 players (list, string, array etc.). Scoring is as follows:

Each heart (♥, represented by integers 1 to 13 inclusive) incurs 1 point
The queen of spades (Q♠, represented by 0) incurs 13 points
Exception: if a player has taken all of the penalty cards (called shooting the moon), then he incurs 0 points, while all other players incur 26 points.

Test cases
[2, 8, 7, 1], [3, 4], [], [9, 5, 6, 0, 10, 11, 12, 13]     -->  4,  2,  0, 20
[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [], [], [1]   --> 25,  0,  0,  1
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0], [], [], [] -->  0, 26, 26, 26

Shortest code in bytes wins.

CJam, 22 20 bytes
Thanks to jimmy23013 for saving 2 bytes.
{{XD?}f%1fb_26&1bf^}

An unnamed block (function), which takes a list of 4 lists as input and returns the list of scores.
Try it online!
Explanation
{      e# For each card...
  XD?  e#   Choose 1 if it's positive and 13 if it's zero.
}f%
1fb    e# Sum each hand.
_26&   e# Get the set intersection of the scores with 26. This gives [26]
       e# if someone shot the moon, and [] otherwise.
1b     e# Treat as base-1 digits, which gives 26 if someone shot the moon
       e# and zero otherwise.
f^     e# XOR each result with this number. This swaps zeros and 26s when
       e# someone shot the moon and does nothing otherwise.

_26&1b. -2 bytes.

@jimmy23013 Ahhhh, 1b... I was trying to find a short way to turn [26] into 26 and [] into 0 but somehow that didn't occur to me. Thank you :)

R, 85 77 74 bytes
function(x,z=sapply(x,function(x)sum(x>0)+any(x<1)*13))abs(z-any(z>25)*26)

Unnamed function that takes an R-list as input. Works by counting the number of elements >0 and adds 13 if any element within each vector is <1 (i.e. queen of spades) and store as z.
If any element in z is >25, return 26-z, else return z.
Try it on R-fiddle

Would 26-z work?

@lastresort Yes of course. /facepalm

C++14, 158 bytes
As unnamed Lambda:
[](auto c){typename decltype(c)::value_type r;int b=0;for(auto d:c){int q=0;for(auto i:d)q+=i?1:13;r.push_back(q);b+=q==26;}if(b)for(int&x:r)x=26-x;return r;}

Requires a vector<vector<int>> and returns vector<int>
Ungolfed:
[](auto c){
 typename decltype(c)::value_type r;   //result vector
 int b=0;                              //flag if one has all cards
 for(auto d:c){                        //over all decks
  int q=0;                             //count points
  for(auto i:d) q+=i?1:13;             //+13 for queen, +1 else
  r.push_back(q);                      //add to result
  b+=q==26;                            //possibly activate flag
 }
 if(b) for(int&x:r) x=26-x;            //if flag is set, mirror the results
 return r;
}

Few testcases for you:
 auto r = std::vector<std::vector<int>>{{2,8,7,1},{3,4},{},{9,5,6,0,10,11,12,13}};
 auto s = std::vector<std::vector<int>>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0},{},{},{}};
 auto t = std::vector<std::vector<int>>{{},{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0},{},{1}};

Python 2, 75 72 71 bytes
i=[len(a)+12*(0in a)for a in input()]
print[[x,26-x][26in i]for x in i]

Takes input as [2, 8, 7, 1], [3, 4], [], [9, 5, 6, 0, 10, 11, 12, 13]

Could you save 3 characters by using 12*[0in a] instead of [0,12][0in a]?

@Costantino I think you mean 12*(0in a).

print[[x,26-x][26in i]for x in i] is one byte shorter.

Haskell, 62 59 56 bytes
f x|all(<26)x=x|0<1=map(26-)x
f.map(sum.map((13^).(0^)))

Usage:
> f.map(sum.map((13^).(0^))) $ [[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [], [], [1]]
[25,0,0,1]

I think you can write f as f n=13^0^n.

@xnor I think you're right. Saves 3 bytes.

I think defining f x|all(<26)x=x|0<1=map(26-)x and using it in place of the lambda function saves some bytes.

@Zgarb right you are, I'd say that's another 3 bytes.

PHP, 113 bytes
function h($a){foreach($a as&$b)$b=count($b)+12*in_array(0,$b);if(max($a)>25)foreach($a as&$n)$n=26-$n;return$a;}

function takes an array of arrays, returns an array of values.

Marvel the other array mapping in PHP: loops with referenced items. Waaay shorter than array_map.

05AB1E, 26 22 21 bytes
Trailing whitespace must be removed from input so that it is interpreted as an array.
The ending was inspired of the other answers when using (26-x) when a player gathered all penalty cards.
vy0å12*yg+})D26©åi(®+

v                    For each array
 y                   Push array on the stack
  0å                 Generate a boolean array indicating whether the queen of spades is at the same index in the original array
    12*              Multiply by 12 the value of the queen of spades
       yg+           Add the length of the array; the queen of spades gets her last point from this part
          }          End for
           )         Push an array of all evaluated scores
            D26©å    1 if there is a 26, 0 otherwise
                 i   If there is a 26
                  (®+ Mirror the array: for each element yield 26-element
                      Implicit end if
                      Implicitly print the score array

Try it online!
It still looks pretty golfable, with duplicated constants and conditional statements.
Former version, 26 bytes
(One byte for each point in maximal penalty value)
I decided to keep it as its length fits best this challenge in my opinion :) .
vyD0å12*sg+})D26©QDOi_®*ë\

Try it online!

JavaScript (ES6), 82 80 77 72 70 69 67 bytes
Saved 2 bytes thanks to @Neil

f =
s=>s.map(c=>c.map(t=>r+=t?1:13,r=0)|(b|=r>25,r),b=0).map(c=>b*26^c)

console.log(f.toString().length)
console.log(f([[2, 8, 7, 1], [3, 4], [], [9, 5, 6, 0, 10, 11, 12, 13]]));
console.log(f([[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [], [], [1] ]));
console.log(f([[0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], [], [1], [] ]));
console.log(f([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0], [], [], []]));
console.log(f([[],[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0], [], []]));

Breakdown
s=>s.map(                              // for each hand
 c=>c.map(                             // for each card
  t=>r+=t?1:13,                        // add value of card
 r=0)|(
  b=b|r>25,r                           // set flag if any hand scores 26 points
 ),
 b=0)
.map(c=>b?                             // for every card if a hand scored 26
  c?0:26                               // set every 0 hand to 26 and the 26 hand to 0
:c)                                    // otherwise do nothing

c=>b*26^c saves 2 bytes.

s=>s.map(b=c=>c.map(t=>r+=t?1:13,r=0)|(b|=r>25,r)).map(c=>b*26^c)?

Python 3, 101 bytes
def s(a):r=[sum([(1,13)[c==0]for c in h])for h in a];s=(r,[(26,0)[s==26]for s in r]);return s[26in r]

Full code:
def score(hands):
    result = [sum([(1, 13)[card == 0] for card in hand]) for hand in hands]
    results = (result, [(26, 0)[score == 26] for score in result])
    return results[26 in result]

12*(c<1)+1 is 2 bytes shorter than (1,13)[c==0]. 26*(s>25) is 3 bytes shorter than (26,0)[s==26].

Ruby, 59 bytes
->a{a.map{|h|a.max.size>13?h.min||26:h.size+12*h.count(0)}}

Or, alternatively,
->a{a.map{|h|a.count([])>2?h.min||26:h.size+12*h.count(0)}}

If only one hand has any cards, we want the empty hands to get a value of 26, and the hand with cards to get a value of 0. I do this by calling min on the hands - this returns nil for an empty array, and then I || it into 26. In other cases, I count the number of cards in a hand and then add 12 to the Queen of Spades.

Pip, 28 bytes
27 bytes of code, +1 for -p flag.
Y{$+1+12*!*a}M Va26Ny?26-yy

Takes input on the command-line as a string representing a nested list, like "[[2 8 7 1] [3 4] [] [9 5 6 0 10 11 12 13]]" (quotes not needed on TIO). Try it online!

Vyxal, 18 bytes
ƛ0c12*nL+;:26c[26꘍

Try it online or run all the test cases.
How?
ƛ0c12*nL+;:26c[26꘍
ƛ                   # For each inner list in the (implicit) input:
 0c                 # Does it contain a zero (the queen of spades)?
   12*              # Multiply this by 12 (aka if it contains a zero, then 12, otherwise 0)
      nL+           # Add the length of the inner list to this
         ;          # Close map lambda
          :         # Duplicate
           26c      # Does it contain 26? (aka someone shot the moon)
              [26꘍  # Then bitwise XOR each with 26 (swapping 26 and 0)

Scala, 93 bytes
a=>{val% =a.map(_.map{case 0=>13;case _=>1}sum)
if(%toSet 26)%map{case 0=>26;case _=>0}else%}

Usage:
val f:(Seq[Seq[Int]]=>Seq[Int])=...
f(Seq(Seq(2, 8, 7, 1), Seq(3, 4), Seq(), Seq(9, 5, 6, 0, 10, 11, 12, 13)))

Explanation:
a=>{           //define an anonymou function with a parameter a
  val% =         //define % as...
    a.map(         //map each element of a...
      _.map{         //to each of the card
        case 0=>13     //replaced with its value
        case _=>1
      }
      sum            //and the sum of the values
    )
  if(            //if
    %toSet 26      //one player has all cards
  )
    %map{          //return % with...
      case 0=>26     //each 0 replaced with 26
      case _=>0      //and everything else (aka the 26) replaced 0
    }
  else           //else
    %              //return %
}

I could use %toSet 26 instead of % contains 26 because Set's apply method is contains and not get-at-index like Seq's

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Manoeuvre the grid!
Briefing
You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number.
Here's how the grid works:
You can move in 4 directions: north, south, east or west. Once you move off a cell, you are not allowed to go back to that cell again (so effectively, it's been wiped off the map).
There is a "counter", which goes 1234567890 (so it goes from 1 to 2... all the way to 9, then to 0, then back to 1 again), which changes every time you move.
You also have a "value", which starts off at 0.
Once you move in any direction, a mathematical operation occurs, depending on what direction you move:

North: Your value is increased by counter (value += counter).
East: Your value is decremented by counter (value -= counter).
South: Your value is multiplied by counter (value *= counter).
West: Your value is divided by counter (value /= counter).

Division is integer division, so 5/2 -> 2.
You are not allowed to divide by 0.

Example:
If the bot moves north 3 times:

The first "north" move increments the counter to 1, and adds that to the value (which is now 1).
The second "north" move increments the counter to 2, and adds that to the value (which is now 3).
The third "north" move increments the counter to 3, and adds that to the value (which is now 6).

The final value is 6.
Move north, then south again:

The first "north" move increments the counter to 1, and adds that to the value (which is now 1).
The second "south" move errors, because the cell the bot is trying to move on is removed (from the first move).

There is no final value, because the bot errored.
Challenge
Your challenge is to write a program when, given a number, produce the suitable directions for the bot to go in so that the final value of the bot is equal to that number.
So if the number is 6, a valid solution to that would be:
nnn

(The bot moves north 3 times in a row).
Your test values are:
49445094, 71259604, 78284689, 163586986, 171769219, 211267178, 222235492, 249062828, 252588742, 263068669, 265657839, 328787447, 344081398, 363100288, 363644732, 372642304, 374776630, 377945535, 407245889, 467229432, 480714605, 491955034, 522126455, 532351066, 542740616, 560336635, 563636122, 606291383, 621761054, 648274119, 738259135, 738287367, 748624287, 753996071, 788868538, 801184363, 807723631, 824127368, 824182796, 833123975, 849666906, 854952292, 879834610, 890418072, 917604533, 932425141, 956158605, 957816726, 981534928, 987717553

(These are 50 random numbers from 1 to 1 billion.)
Your score is the total amount of moves made for all 50 numbers - the fewer moves, the better. In case of a tie, the person who submitted their code earlier wins.
Specs

You are guaranteed receive a positive integer for input.
Your value variable must not go above 2^31-1 or below -2^31 at any point for your generated paths.
Your final program must fit in an answer (so, < 30,000 bytes).
You may only hard-code 10 numbers.
Your program must run within 5 minutes on a reasonable laptop for any test case.
The results MUST be the same every time the program is run for each number.

Shouldn't this be code-challenge instead of atomic-code-golf? You're not scoring by the size of the submitted program, not even as a tie-breaker, you're scoring by size of the output, which makes this an algorithmic challenge and not a code golf problem.

@marinus Fixed. I thought atomic code golf was for the program - I must have gotten confused.

Is there a proof this is possible?

1. I think you should add a rule that submissions have to be runnable on a computer with specs X and a time frame Y. One of the current answers claims a perfect score, but I doubt it could actually calculate it. 2. You are not allowed to calculate values above [...] That refers to the variable value, yes? At least to me, it sounds like a restriction imposed on the implementation, not the actual algorithm.

@Dennis Do you think 10 minutes is enough for all 50 test cases?

Your solution takes over a minute on my machine, solely to print the required characters. Maybe 10 minutes is a bit too harsh. Also, as someone else has pointed out, your answer only works if the input is positive, yet your spec doesn't seem to mention that this will be the case.

@Dennis Fixed the specs. Also, I made the time restraint a bit more lenient.

Isn't it supposed to spelled Maneuver?

There are 4 different optimal ways to get 6: nnn, nss, wns, sns

@Oliver Yes, that's another alternative way.

C++: score = 453,324,048
OK, needed some time to rework this, but here's the way I solved it.
After studying the solution space, I decided that my strategy would be:

Uses the south steps to get as close to the target number

if the target is positive, follow this path: nnnesssssessssssss
if the target is negative, follow this path: esssssssseessssss
c. if the target is between 0 and 20, solve it "the old fashion way" (trail and error over every possible path til we reach it).
Once we have our "best place" (get as close to the target, without going "over"), we may be able to get closer by multiplying by 2 or 3; so take between 0 to 9 steps east, and then one step south.  keep the path that gets us the closest to the target.
"Run" north, or east til we are within 45 points of the target (every 10 steps north, add 45 points to the score, like wise, every 10 steps east, reduces the score by 45).

Take a few more steps in the same direction, til we are within 10 points of the target
Do "the old fashion way" from this point, it shouldn't be that hard now.

Here's my result: total score is 453324048
And the paths:
  0) to reach   49445094, it takes   1311037 steps, by doing: nnnesssssesssssseeeeese(n *     1311010)enen
  1) to reach   71259604, it takes   1320313 steps, by doing: nnnesssssesssssseeeeeese(n *     1320280)nnnnnneee
  2) to reach   78284689, it takes   1956998 steps, by doing: nnnesssssesssssseeeeeees(e *     1956970)eeee
  3) to reach  163586986, it takes   2483885 steps, by doing: nnnesssssessssssse(n *     2483860)nnnnnnn
  4) to reach  171769219, it takes   4302163 steps, by doing: nnnesssssessssssse(n *     4302130)nnnnnnnnnnennnn
  5) to reach  211267178, it takes  13079485 steps, by doing: nnnesssssessssssse(n *    13079460)nnnnnen
  6) to reach  222235492, it takes  15516886 steps, by doing: nnnesssssessssssse(n *    15516860)nnnnnnnn
  7) to reach  249062828, it takes  12390325 steps, by doing: nnnesssssessssssseeees(e *    12390290)eeeeenenneene
  8) to reach  252588742, it takes  11606785 steps, by doing: nnnesssssessssssseeees(e *    11606760)een
  9) to reach  263068669, it takes   9277915 steps, by doing: nnnesssssessssssseeees(e *     9277880)eeeeenennneee
 10) to reach  265657839, it takes   8702543 steps, by doing: nnnesssssessssssseeees(e *     8702510)eeeeenennee
 11) to reach  328787447, it takes   5326312 steps, by doing: nnnesssssessssssseeeese(n *     5326280)nnnnennnn
 12) to reach  344081398, it takes   8724966 steps, by doing: nnnesssssessssssseeeese(n *     8724940)enn
 13) to reach  363100288, it takes  12951386 steps, by doing: nnnesssssessssssseeeese(n *    12951360)enn
 14) to reach  363644732, it takes  13072373 steps, by doing: nnnesssssessssssseeeese(n *    13072340)nnnnnnnnen
 15) to reach  372642304, it takes  15071833 steps, by doing: nnnesssssessssssseeeese(n *    15071800)nnnnnnnenn
 16) to reach  374776630, it takes  15546133 steps, by doing: nnnesssssessssssseeeese(n *    15546100)nnnnnenene
 17) to reach  377945535, it takes  16250331 steps, by doing: nnnesssssessssssseeeese(n *    16250300)nnnnennn
 18) to reach  407245889, it takes  11107325 steps, by doing: nnnesssssessssssseeeees(e *    11107300)ne
 19) to reach  467229432, it takes   2222403 steps, by doing: nnnesssssessssssseeeeese(n *     2222370)nnnnnnnee
 20) to reach  480714605, it takes   5219109 steps, by doing: nnnesssssessssssseeeeese(n *     5219080)neenn
 21) to reach  491955034, it takes   7716983 steps, by doing: nnnesssssessssssseeeeese(n *     7716950)nnnnennnn
 22) to reach  522126455, it takes  14421745 steps, by doing: nnnesssssessssssseeeeese(n *    14421710)nnnnnneneee
 23) to reach  532351066, it takes  16693875 steps, by doing: nnnesssssessssssseeeeese(n *    16693850)n
 24) to reach  542740616, it takes  14866179 steps, by doing: nnnesssssessssssseeeeees(e *    14866150)eeeen
 25) to reach  560336635, it takes  10955953 steps, by doing: nnnesssssessssssseeeeees(e *    10955920)eeeeennen
 26) to reach  563636122, it takes  10222731 steps, by doing: nnnesssssessssssseeeeees(e *    10222700)eeeeene
 27) to reach  606291383, it takes    743785 steps, by doing: nnnesssssessssssseeeeees(e *      743760)e
 28) to reach  621761054, it takes   2693968 steps, by doing: nnnesssssessssssseeeeeese(n *     2693940)nnn
 29) to reach  648274119, it takes   8585761 steps, by doing: nnnesssssessssssseeeeeese(n *     8585730)nnnnnn
 30) to reach  738259135, it takes   5286413 steps, by doing: nnnesssssessssssseeeeeees(e *     5286380)eeneneee
 31) to reach  738287367, it takes   5280141 steps, by doing: nnnesssssessssssseeeeeees(e *     5280110)nneenn
 32) to reach  748624287, it takes   2983042 steps, by doing: nnnesssssessssssseeeeeees(e *     2983010)eeeenee
 33) to reach  753996071, it takes   1789313 steps, by doing: nnnesssssessssssseeeeeees(e *     1789280)eeeennee
 34) to reach  788868538, it takes   5960183 steps, by doing: nnnesssssessssssseeeeeeese(n *     5960150)nnenene
 35) to reach  801184363, it takes   8697033 steps, by doing: nnnesssssessssssseeeeeeese(n *     8697000)nnenene
 36) to reach  807723631, it takes  10150197 steps, by doing: nnnesssssessssssseeeeeeese(n *    10150170)n
 37) to reach  824127368, it takes  13795475 steps, by doing: nnnesssssessssssseeeeeeese(n *    13795440)nnnnnnnne
 38) to reach  824182796, it takes  13807795 steps, by doing: nnnesssssessssssseeeeeeese(n *    13807760)nnnnnenee
 39) to reach  833123975, it takes  15794722 steps, by doing: nnnesssssessssssseeeeeeese(n *    15794690)nennnn
 40) to reach  849666906, it takes  14397917 steps, by doing: nnnesssssessssssseeeeeeees(e *    14397880)eeeeeeeenee
 41) to reach  854952292, it takes  13223389 steps, by doing: nnnesssssessssssseeeeeeees(e *    13223350)eeeeeeeeneeen
 42) to reach  879834610, it takes   7693981 steps, by doing: nnnesssssessssssseeeeeeees(e *     7693950)eeenn
 43) to reach  890418072, it takes   5342102 steps, by doing: nnnesssssessssssseeeeeeees(e *     5342070)eeennn
 44) to reach  917604533, it takes    699395 steps, by doing: nnnesssssessssssseeeeeeeese(n *      699360)nnnneene
 45) to reach  932425141, it takes   3992863 steps, by doing: nnnesssssessssssseeeeeeeese(n *     3992830)nennnn
 46) to reach  956158605, it takes   9266963 steps, by doing: nnnesssssessssssseeeeeeeese(n *     9266930)nnnnen
 47) to reach  957816726, it takes   9635434 steps, by doing: nnnesssssessssssseeeeeeeese(n *     9635400)nnnennn
 48) to reach  981534928, it takes  14906145 steps, by doing: nnnesssssessssssseeeeeeeese(n *    14906110)nnnnnnnn
 49) to reach  987717553, it takes  16280059 steps, by doing: nnnesssssessssssseeeeeeeese(n *    16280030)nn

I'm sure there's a way to improve on this by doing some cleaver "south/west" moves (dividing by 4 and multiplying by 5; for example); but coding it, and making sure you don't over lap or get trapped, is tricky.
Another solution path, may be to try to go back down from the target, to a "reasonable" number, and then, just find a path to that smaller number; but you'll have to "aim" it right, so that the step number will match.  tricky, but might be the best way to solve this.
Anyway, here is my code code:
#include <stdio.h>
#include <vector>
#include <queue>;

using namespace std;

long long upperLimit;
long long lowerLimit;
bool bDebugInfo = false;
//bool bDebugInfo = true;

//  a point struct (x and y)
struct point
{
    int x;
    int y;

    point():x(0),y(0)
    {
    }

    bool operator ==(const point& other)
    {
        return (x==other.x) && (y==other.y);
    }

    void ApplyDirection(char direction)
    {
        switch (direction)
        {
        case 'n':
            y++;
            break;
        case 'w':
            x--;
            break;
        case 'e':
            x++;
            break;
        case 's':
            y--;
            break;
        }
    }
};

// each state is of this formate
struct botState
{
    int nStep;
    long long number;
    vector<char> path;

    botState()
        :nStep(0),
        number(0)
    {
    }

    botState* clone()
    {
        botState* tmp = new botState();
        tmp->nStep = nStep;
        tmp->number = number;
        tmp->path = path;
        return tmp;
    }

    void clone(botState* other)
    {
        nStep = other->nStep;
        number = other->number;
        path = other->path;
    }

};

bool changeNumberWithDirection(long long &number, char direction, int step)
{
    switch (direction)
    {
    case 'n':
        number += (step%10);
        break;
    case 'w':
        if (step%10)
            number /= (step%10);
        else
            return false;
        break;
    case 'e':
        number -= (step%10);
        break;
    case 's':
        number *= (step%10);
        break;

    default:
        return false;
    }

    return true;
}

bool tryToAddStep(queue<botState*>& queueOfStates, const botState* pState, char direction, char cStarDirection)
{
    botState* pTmpState;
    long long newNumber;
    int newStep = pState->nStep+1;

    newNumber = pState->number;
    if (!changeNumberWithDirection(newNumber, direction, newStep))
        return false;

    if (newNumber > upperLimit)
        return false;

    if (newNumber < lowerLimit)
        return false;

    if ((newNumber == 0) && (newStep%10 == 0))
        return false;                // no need to return back to 0 after 10 or more steps, we already have better ways to do this.

    // build the x,y points of the path up to this point
    point tmpPoint;
    vector<point> pointsInPath;
    pointsInPath.push_back(tmpPoint);

    for (int i=0; i<pState->path.size(); i++)
    {
        if (pState->path.at(i) == '*')
        {
            for (int j=0; j<100; j++)
            {
                tmpPoint.ApplyDirection(cStarDirection);
                pointsInPath.push_back(tmpPoint);
            }
        }
        else
        {
            tmpPoint.ApplyDirection(pState->path.at(i));
            pointsInPath.push_back(tmpPoint);
        }
    }

    tmpPoint.ApplyDirection(direction);

    // check for over lap
    for (int i=0; i<pointsInPath.size(); i++)
    {
        if (tmpPoint == (pointsInPath.at(i)))
            return false;
    }

    pTmpState = new botState();
    pTmpState->nStep = newStep;
    pTmpState->number= newNumber;
    pTmpState->path  = pState->path;

    pTmpState->path.push_back(direction);

    queueOfStates.push(pTmpState);

    return true;
}

bool isBetterNum(long long newNum, long long oldBest, long long target)
{
    long long newDiff = (newNum  > target) ? newNum  - target : target - newNum ;
    long long oldDiff = (oldBest > target) ? oldBest - target : target - oldBest;

    return (newDiff < oldDiff);
}

bool tryToJumpDown(long long num, botState* pState, int& nTimes)
{
    // if where the bot is, we have a clear path to go as far east as we could ever want, we can just do as many sets of eeeeeeeeee (e*10) as needed, til we are close enough to the target
    point tmpPoint;
    vector<point> pointsInPath;
    pointsInPath.push_back(tmpPoint);

    for (int i=0; i<pState->nStep; i++)
    {
        tmpPoint.ApplyDirection(pState->path.at(i));
        pointsInPath.push_back(tmpPoint);
    }

    for (int i=0; i<pointsInPath.size(); i++)
    {
        if ((pointsInPath.at(i).x > tmpPoint.x) && (pointsInPath.at(i).y == tmpPoint.y))
            return false;  // we have a point blocking our path up!
    }

    long long tmpTimes = (pState->number - num)/45;
    if ((tmpTimes>1) && (tmpTimes<upperLimit))
    {
        tmpTimes--;
        tmpTimes*=10;
        nTimes = (int)tmpTimes;
        pState->nStep+=nTimes;
        pState->number-=(tmpTimes/10)*45;
        pState->path.push_back('*');
        return true;
    }

    return false;
}

bool tryToJumpUp(long long num, botState* pState, int& nTimes)
{
    // if where the bot is, we have a clear path to go as far north as we could ever want, we can just do as many sets of nnnnnnnnnn (n*10) as needed, til we are close enough to the target
    point tmpPoint;
    vector<point> pointsInPath;
    pointsInPath.push_back(tmpPoint);

    for (int i=0; i<pState->nStep; i++)
    {
        tmpPoint.ApplyDirection(pState->path.at(i));
        pointsInPath.push_back(tmpPoint);
    }

    for (int i=0; i<pointsInPath.size(); i++)
    {
        if ((pointsInPath.at(i).x == tmpPoint.x) && (pointsInPath.at(i).y > tmpPoint.y))
            return false;  // we have a point blocking our path up!
    }

    long long tmpTimes = (num - pState->number)/45;
    if ((tmpTimes>1) && (tmpTimes<upperLimit))
    {
        tmpTimes--;
        tmpTimes*=10;
        nTimes = (int)tmpTimes;
        pState->nStep+=nTimes;
        pState->number+=(tmpTimes/10)*45;
        pState->path.push_back('*');
        return true;
    }

    return false;
}

typedef char* PChar;

bool buildPath(long long num, PChar& str, int& nLen, int& nScore, botState* startState, int nTimes)
{
    long long nBest = 0;
    int nMaxSteps = 0;
    long long nMax = 0;
    long long nMin = 0;
    int nCleanUpOnStep= 12;
    long long nFromLastCleanUp = 0;
    bool bInCleanUp = false;
    char cDirection = ' ';

    if (nTimes>0)
        cDirection = 'n';
    else if (nTimes<0)
    {
        cDirection = 'e';
        nTimes*=-1;
    }

    if (startState->nStep >= nCleanUpOnStep)
        nCleanUpOnStep= startState->nStep+10;

    str  = NULL;
    nLen = 0;
    botState* bestState = new botState();
    bestState->clone(startState);
    queue<botState*> queueOfStates;
    queueOfStates.push(bestState);  // put the starting state into the queue

    while (!queueOfStates.empty())       // while we still have states in the queue, process them
    {
        botState* pState = queueOfStates.front();
        queueOfStates.pop();             // take a state out of the queue

        if (!str)                        // no solution yet
        {
            if (pState->number == num)   // check if this is a solution
            {
                // we solved it!
                int nOffset=0;
                nLen = pState->nStep - nTimes + 17;
                str = new char[nLen+1];
                if (bDebugInfo)
                    printf("solved!\n");
                nScore = pState->nStep;
                for (int i=0; i<pState->path.size(); i++)
                {
                    if (pState->path.at(i)=='*')
                    {
                        sprintf(str+i, "(%c * %11d)", cDirection, nTimes);
                        if (bDebugInfo)
                            printf("(%c * %11d)", cDirection, nTimes);
                        nOffset=16;
                    }
                    else
                    {
                        str[i+nOffset] = pState->path.at(i);
                        if (bDebugInfo)
                            printf("%c", str[i+nOffset]);// print solution while making the string
                    }
                }
                if (bDebugInfo)
                    printf("\n");
                str[nLen]='\0';
            }
            else
            {                            // no solution yet, we need to go deeper
                if (pState->number < nMin)
                    nMin = pState->number;

                if (pState->number > nMax)
                    nMax = pState->number;

                if ((!bInCleanUp) && (queueOfStates.size()>1000000))
                {
                    nCleanUpOnStep=nMaxSteps+10;
                    bInCleanUp = true;
                }
                if (pState->nStep > nMaxSteps)
                {                        // a little tracing, so we can see progress
                    nMaxSteps = pState->nStep;
//                    printf("current states have %d steps, reached a max of %lld, and a min of %lld\n", nMaxSteps, nMax, nMin);
                    if (nMaxSteps >= nCleanUpOnStep)
                    {
                        nCleanUpOnStep+=10;
                        bInCleanUp = true;
                    }
                }

                if (isBetterNum(pState->number, nBest, num))
                {                        // a little tracing, so we can see progress
                    nBest = pState->number;
                    if (bDebugInfo)
                        printf("Got closer to the target, %lld, with %d steps (target is %lld, diff is %lld)\n", nBest, pState->nStep, num, num-nBest);
                    if (bestState != pState)
                        delete bestState;
                    bestState = pState;
                }

                if (!bInCleanUp)
                {
                    tryToAddStep(queueOfStates, pState, 'n', cDirection);
                    tryToAddStep(queueOfStates, pState, 'e', cDirection);

                    if (!nTimes)  // once we did the "long walk in one direction" don't do the west or south moves any more
                    {
                        tryToAddStep(queueOfStates, pState, 'w', cDirection);
                        tryToAddStep(queueOfStates, pState, 's', cDirection);
                    }
                }
            }
        }
        if (pState!=bestState)
            delete pState;                  // this is not java, we need to keep the memory clear.

        if ((bInCleanUp) && (queueOfStates.empty()))
        {
            queueOfStates.push(bestState);  // put the starting state into the queue
            bInCleanUp = false;
            long long diff = nFromLastCleanUp-bestState->number;
            if (!nTimes)
            {
                if ((diff>0) && (diff<100))
                    if (tryToJumpDown(num, bestState, nTimes))
                        cDirection = 'e';
                if ((diff<0) && (diff>-100))
                    if (tryToJumpUp(num, bestState, nTimes))
                        cDirection = 'n';

                if (nTimes)
                    nCleanUpOnStep = bestState->nStep;
            }
            nFromLastCleanUp = bestState->number;
        }
    }

    delete bestState;                  // this is not java, we need to keep the memory clear.
    return str!=NULL;
}

char* positiveSpine = "nnnesssssessssssss";
char* negativeSpine = "esssssssseessssss";

bool canReachNumber(long long num, PChar& str, int& nLen, int& nScore)
{
    int nTimes = 0;
    botState tmpState;
    if ((num>=0) && (num<=20))
        return buildPath(num, str, nLen, nScore, &tmpState, nTimes);

    botState bestState;
    bestState.clone(&tmpState);

    char* spine = NULL;
    if (num>0)
    {
        spine = positiveSpine;
    }
    else
    {
        spine = negativeSpine;
    }

    for (int i=0; spine[i]; i++)
    {
        tmpState.nStep++;
        tmpState.path.push_back(spine[i]);
        if (!changeNumberWithDirection(tmpState.number, spine[i], tmpState.nStep))
            return false;

        if ((num>0) && (tmpState.number<num))
        {
            bestState.clone(&tmpState);
        }
        else if ((num<0) && (tmpState.number>num))
        {
            bestState.clone(&tmpState);
        }
    }

    if (bestState.number == num)
        return buildPath(num, str, nLen, nScore, &bestState, nTimes);

    botState tryPath;
    tmpState.clone(&bestState);
    for (int i=0; i<9; i++)
    {
        tryPath.clone(&tmpState);
        bool pathOK = true;
        for (int j=0; j<i; j++)
        {
            tryPath.nStep++;
            tryPath.path.push_back('e');
            if (!changeNumberWithDirection(tryPath.number, 'e', tryPath.nStep))
            {
                pathOK = false;
                break;
            }
        }
        tryPath.nStep++;
        tryPath.path.push_back('s');
        if (!changeNumberWithDirection(tryPath.number, 's', tryPath.nStep))
        {
            pathOK = false;
            break;
        }

        if ((pathOK) && (isBetterNum(tryPath.number, bestState.number, num)))
        {
            bestState.clone(&tryPath);
        }
    }

    // in case we'll need to add, but last step was south, move one to the east.
    if ((bestState.path.at(bestState.path.size()-1) == 's') && (bestState.number<num))
    {
        bestState.nStep++;
        bestState.path.push_back('e');
        if (!changeNumberWithDirection(bestState.number, 'e', bestState.nStep))
            return false;
    }

    if (bestState.number<num)
    {
        long long diff = num - bestState.number;
        diff/=45;
        nTimes = (int)diff*10;
        bestState.nStep += nTimes;
        bestState.path.push_back('*');
        bestState.number += 45*diff;
        while (num - bestState.number > 10)
        {
            bestState.nStep++;
            bestState.path.push_back('n');
            if (!changeNumberWithDirection(bestState.number, 'n', bestState.nStep))
                return false;
        }
        return buildPath(num, str, nLen, nScore, &bestState, nTimes);
    }
    else
    {
        long long diff = bestState.number - num;
        diff/=45;
        nTimes = (int)diff*10;
        bestState.nStep += nTimes;
        bestState.path.push_back('*');
        bestState.number -= 45*diff;
        while (bestState.number - num > 10)
        {
            bestState.nStep++;
            bestState.path.push_back('e');
            if (!changeNumberWithDirection(bestState.number, 'e', bestState.nStep))
                return false;
        }
        return buildPath(num, str, nLen, nScore, &bestState, -nTimes);
    }

    return false;
}
long long aVals[] = {49445094, 71259604, 78284689, 163586986, 171769219, 211267178, 222235492, 249062828, 252588742, 263068669, 265657839, 328787447, 344081398, 363100288, 363644732, 372642304, 374776630, 377945535, 407245889, 467229432, 480714605, 491955034, 522126455, 532351066, 542740616, 560336635, 563636122, 606291383, 621761054, 648274119, 738259135, 738287367, 748624287, 753996071, 788868538, 801184363, 807723631, 824127368, 824182796, 833123975, 849666906, 854952292, 879834610, 890418072, 917604533, 932425141, 956158605, 957816726, 981534928, 987717553};

void main(void)
{
    upperLimit =     2147483647;       //  2^31 - 1
    lowerLimit =-1;       // -2^31
    lowerLimit *=2147483648;       // -2^31
    long long num=0;
    char* str=NULL;
    int nLen = 0;
    int nItems = sizeof(aVals)/sizeof(aVals[0]);
    int nScore = 0;
    long long nTotalScore = 0;
//  nItems=1;

    for(int i=0; i<nItems; i++)
    {
        if (canReachNumber(aVals[i], str, nLen, nScore))  //try to reach it
        {
            printf("%3d) to reach %10lld, it takes %9d steps, by doing: %s\n", i, aVals[i], nScore, str);

            nTotalScore+=nScore;
            delete str;
        }
        else
        {
            if (aVals[i]>0)
                printf("Failed to reach %lld, use nenenenenenen..... ('n', followed by %lld pairs of 'en')\n", aVals[i], aVals[i]-1);
            else
                printf("Failed to reach %lld, use enenenenenene..... ('e', followed by %lld pairs of 'ne')\n", aVals[i], aVals[i]-1);
            nTotalScore+=2*aVals[i]-1;
        }
    }

    printf("done, total score is %lld\n", nTotalScore);
    return;
}

In esssssssseessssss are you sure variable not overflow? If v=1 t=1 that string mean (1234567-8)1234*5 etc or something as that

@RosLuP that's not -8. it is more like this : ((-1)(23456789)-0-1)234567
which is -1828920240
which is a about -2^30.7683
so it doesn't pass -2^31

Python, Score = 56068747912
def move(n):
    print("n" + "en" * (n - 1))

Just prints nenenenenenenen... for every number.
Will add an explanation later.

Off by 1, isn't it? nen is 2

@edc65 Fixed it.

did you get that score by actually running this code, or is this your "guess", if everything works right?

@EyalLev The latter. It should work as expected, anyway - every "en" after the initial "n" should increment the value by 1 (since the value goes "-2+3-4+5...-0+1-2+3" after the initial "+1").

the problem is, that the requirement is that it takes 10 min'.  not sure if your "let's print them all" way will meet that constraint.

Rust, score = 1758 (optimal among paths with no west)
Runs in about 7 seconds total for 50 numbers, using a bidirectional search.
use std::collections::HashSet;
use std::io::{self, prelude::*};

#[derive(Debug, Eq, Clone, Copy, Hash, Ord, PartialEq, PartialOrd)]
enum Dir {
    N,
    E,
    S,
}
use Dir::{E, N, S};

fn dir_char(dir: Dir) -> char {
    match dir {
        N => 'n',
        E => 'e',
        S => 's',
    }
}

#[derive(Debug, Eq, Clone, Hash, Ord, PartialEq, PartialOrd)]
struct State {
    counter: i32,
    value: i32,
    next: Dir,
}

fn step(s: &State) -> impl Iterator<Item = State> {
    let (values, nexts): (_, &[Dir]) = match s.next {
        N => (s.value.checked_add(s.counter), &[N, E]),
        E => (s.value.checked_sub(s.counter), &[N, E, S]),
        S => (
            if s.counter != 0 {
                s.value.checked_mul(s.counter)
            } else {
                None
            },
            &[E, S],
        ),
    };
    let counter = (s.counter + 1) % 10;
    values.into_iter().flat_map(move |value| {
        nexts.iter().map(move |&next| State {
            counter,
            value,
            next,
        })
    })
}

fn unstep(s: &State) -> impl Iterator<Item = State> {
    let counter = (s.counter + 9) % 10;
    (match s.next {
        N | E => s.value.checked_sub(counter).map(|value| State {
            counter,
            value,
            next: N,
        }),
        _ => None,
    }).into_iter()
        .chain(s.value.checked_add(counter).map(|value| State {
            counter,
            value,
            next: E,
        }))
        .chain(match s.next {
            E | S if counter != 0 && s.value % counter == 0 => {
                s.value.checked_div(counter).map(|value| State {
                    counter,
                    value,
                    next: S,
                })
            }
            _ => None,
        })
}

fn search(value: i32) -> String {
    let mut lefts: Vec<HashSet<State>> = Vec::new();
    let mut left = [N, E, S]
        .iter()
        .map(|&next| State {
            counter: 1,
            value: 0,
            next,
        })
        .collect::<HashSet<_>>();
    let mut rights: Vec<HashSet<State>> = Vec::new();
    let mut right = (0..10)
        .map(|counter| State {
            counter,
            value,
            next: E,
        })
        .collect::<HashSet<_>>();
    loop {
        if let Some(mid) = left.intersection(&right).min() {
            let mut path = Vec::new();
            let mut mid1 = mid.clone();
            for left in lefts.into_iter().rev() {
                let mid2 = unstep(&mid1)
                    .filter(|mid2| left.contains(mid2))
                    .next()
                    .unwrap();
                mid1 = mid2;
                path.push(mid1.next);
            }
            path.reverse();
            let mut mid1 = mid.clone();
            for right in rights.into_iter().rev() {
                let mid2 = step(&mid1)
                    .filter(|mid2| right.contains(mid2))
                    .next()
                    .unwrap();
                path.push(mid1.next);
                mid1 = mid2;
            }
            return path.into_iter().map(dir_char).collect::<String>();
        }
        if left.len() <= right.len() {
            let left1 = left.iter().flat_map(step).collect::<HashSet<_>>();
            lefts.push(left);
            left = left1;
        } else {
            let right1 = right.iter().flat_map(unstep).collect::<HashSet<_>>();
            rights.push(right);
            right = right1;
        }
    }
}

fn main() {
    let stdin = io::stdin();
    let values = stdin
        .lock()
        .lines()
        .flat_map(|line| {
            line.unwrap()
                .split(", ")
                .map(|s| s.parse().unwrap())
                .collect::<Vec<i32>>()
        })
        .collect::<Vec<_>>();

    for value in values {
        println!("{} {}", value, search(value));
    }
}

Try it online!
Output
49445094 nennesseseenenesseseeseseeeeseess
71259604 nnnnnnessennnessseeesssenesenesses
78284689 ennnesssseeeneenesenesssseeesese
163586986 ennnesesseneeeeessennesseeseseeneesen
171769219 ennnessenessssessseesesseeseenesee
211267178 sennnnneseeenessssenessssenenneseseee
222235492 ennnnnesseeeneseesseeesseseneesseesee
249062828 nnnnnesseneneseesssenennesseenesse
252588742 nennnessenneeeessesesesseseeseseeseee
263068669 nennnesseessseeessseesseeenesesssen
265657839 nnnesssseneesesssennneenesseeeses
328787447 eennnesssenesseesssesennnneeseenese
344081398 sennnnesennnesesessesesssseeseennnn
363100288 sennnnesseeneseesssenneesessennenee
363644732 nnnesssenneessesseeesseseseesenees
372642304 nnnnesseneseneseesseneneesssennesese
374776630 sennnnesseseesseneseeeseseessenesen
377945535 nnnesssseneeennesseesseeessseeses
407245889 nnnesseneesessseseseeeeessessenenee
467229432 nnnnesesennnnnesessesessesseeneess
480714605 nnnnessennneseesssenenesenesseesesen
491955034 nnnnnessseeneeeessseeeseenesseseeee
522126455 nnnnesssseeneeesesseesesseeeenese
532351066 nennnessenneeenesesesesessessesenesen
542740616 sennnnesseeneenesssesseenesseesesesen
560336635 nnnesssesesesssseeennessseseeneee
563636122 sennnnnesennneseseennesesssesenesenes
606291383 nnnessssenneeeseseseeseseeeeseesese
621761054 nnnessseennessesssenneeseseseess
648274119 nnnnessseneesseseeseenessseeneseeese
738259135 eennnnnesenennnesseneessssssennnees
738287367 nnnessesseessseseseneeesesseennen
748624287 nennnesseesseeenneseessseseeseneseseese
753996071 nnnnessseneeeseesssenesesenennnesesen
788868538 nnnessesseeseeeneeseesesseesseseeseee
801184363 ennnesseseeseeeeseseeeeseeseseessse
807723631 nnnessessessssesseennnnesssen
824127368 nnnnessesenessseseennnessseesesennnnn
824182796 nnnnessesenesssseenesssesssenesee
833123975 ennnnnneseeeennnessesssessseennnneeesse
849666906 sennnessseeeeseesesesssenesseneeeesen
854952292 nnnnnnesenenesssseeneeessessseseeeeeeee
879834610 nennnnesseessseneeseeesessseseneee
890418072 nnnesssennnnessesesennnesessennnnees
917604533 ennnnesseneeseeesesenennesesseeneesse
932425141 ennnnesssesseesesenesssessseeneesen
956158605 nnnnesseseeeeesesssennneseseenesseee
957816726 enennnesseseeseesseessessssenesss
981534928 eennnessennessseesseesessseenessseenn
987717553 nnnessseeneeesssesseesssesennessee

You can never return to a cell so every ns, sn, ew and we is immediately illegal in addition to any loops in the path

@Veskah Thanks for pointing that out. Fixed by disallowing w, ns, and sn, which leaves only legal paths at the expense of ignoring legal paths with w.

PHP, Score=1391462099
function manoeuvre($n){
  $i=0;
  $c=0;
  $char='';
  while($i!=$n){
    $c=($c+1)%10;
    if($char!='n' and $c>0 and $i>0 and $i*$c<=$n){
      $char='s';
      $i=$i*$c;
    }
    else if($char!='s' and $i+$c<=$n and ($i-$c<=0 or ($i-$c)*max(($c+1)%10,2)>$n or $c==9)){
      $char='n';
      $i=$i+$c;
    }
    else{
      $char='e';
      $i=$i-$c;
    }
    echo $char;
  }
}

A quick attempt, never goes west to simplify path checking and has few rules to decide direction at each step.


text:
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 code-golf, shortest code in bytes wins!

This format has a severe data loss problem...:p

Are leading/trailing spaces allowed?

@Arnauld As long as they don't disturb the position of the characters they are. So most likely just trailing spaces

Related

How would the output of the word golf look by itself?

@gabe3886 gfl

It seems you can change the accepted answer back to Charcoal again. ;p

Charcoal, 29 27 20 19 bytes
ＦＳ«Ｆ№rdlu↧ι≔ιω✳∨ωrι

Try it online! Link is to verbose version of code. Explanation:
ＦＳ«

Loop over the input characters.
Ｆ№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.

@Veskah The ⌕ was supposed to be a №. Sorry about that.

Dyalog APL, 63 bytes
s@(n+11 9∘○¨+\0j1*⊃¨,⍨\(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

C#, 525 474 Bytes
Edit: Saved 51 Bytes thanks to @steenbergh
It's not pretty, but it does work...
Golfed:
string W(string s){var l=s.Length;var a=new char[2*l+1,2*l+1];int x=2*l/2;int y=2*l/2;int d=0;for(int i=0;i<l;i++){switch(char.ToUpper(s[i])){case'U':d=3;break;case'D':d=1;break;case'L':d=2;break;case'R':d=0;break;}a[y,x]=s[i];switch(d){case 0:x+=1;break;case 1:y+=1;break;case 2:x-=1;break;case 3:y-=1;break;}}string o="";for(int i=0;i<2*l+1;i++){string t="";for(int j=0;j<2*l+1;j++)t+=a[i,j]+"";o+=t==string.Join("",Enumerable.Repeat('\0',2*l+1))?"":(t+"\r\n");}return o;}

Ungolfed:
public string W(string s)
{
  var l = s.Length;
  var a = new char[2 * l + 1, 2 * l + 1];
  int x = 2 * l / 2;
  int y = 2 * l / 2;
  int d = 0;
  for (int i = 0; i < l; i++)
  {
    switch (char.ToUpper(s[i]))
    {
      case 'U':
        d = 3;
        break;
      case 'D':
        d = 1;
        break;
      case 'L':
        d = 2;
        break;
      case 'R':
        d = 0;
        break;
    }
    a[y, x] = s[i];
    switch (d)
    {
      case 0:
        x += 1;
        break;
      case 1:
        y += 1;
        break;
      case 2:
        x -= 1;
        break;
      case 3:
        y -= 1;
        break;
    }
  }
  string o = "";
  for (int i = 0; i < 2 * l + 1; i++)
  {
    string t = "";
    for (int j = 0; j < 2 * l + 1; j++)
      t += a[i, j] + "";
    o += t == string.Join("", Enumerable.Repeat('\0', 2 * l + 1)) ? "" : (t + "\r\n");
  }
  return o;
}

Explanation:
Uses a two-dimensional array and the d value to increment the position of the array in the correction direction, where d values are:
0 => RIGHT
1 => DOWN
2 => LEFT
3 => UP

Test:
var walkTheWords = new WalkTheWords();
Console.WriteLine(walkTheWords.W("codegolf and programming puzzles"));

                            cod
                              e
                              g
                              o
                         dna fl    sel
                                     z
                         p           z
                         rogramming pu

you can remove the second switch completely.In first switch where you write d=0;, replace this statement by the statement in second switch case 0: statement and do similar to other cases and you may not need a second switch.And lastly remove this statement a[y,x]=s[i] and write it on top of first switch.

@MukulKumar Nice idea, I can't get it to work. I tried to do it in one switch initially. It's got to stay in it's current dual-switch configuration! :)

did you write a[y,x]=s[i] before first switch?

@MukulKumar Yes I tried that and a few more things. The letters came out all jumbled up...but not in the way they were supposed to :)

well...I will try a solution in similar language..;)

You can use switch(s[i].toLowerCase()) (or what's the c# equivalent...) and then remove all uppercase cases. Should save some bytes.

@steenbergh Yes, char.ToUpper() (orchar.ToLower()), thanks! :)

I haven't seen# in years... can't you call ToUpper() directly on the string fragment s[i], instead of invocing a static member on the char type? ie switch (char.ToUpper(s[i])) --> switch (s[i].ToUpper())

Also, you can drop the default cases in the switches. And there seem to be a few excess spaces.

@steenbergh Thanks, major savings there! No, you can't directly ToUpper() because it's a char not a string. The choices are either s[i].ToString().ToUpper() or char.ToUpper(s[i]) - I think the char one is slightly shorter. Cheers :)

I know it's been about halve a year since you've posted this, but there are quite a few basic things to golf: 2*l/2 is l, int x=2*l/2;int y=2*l/2;int d=0;for(int i=0;i<l;i++) can be int x=2*l/2,y=2*l/2,d=0,i=0,j;for(;i<l;i++) (and remove the two additional int s in the code). char.ToUpper(s[i]) can be (char)(s[i]&~32). If statements are definitely shorter than switches with breaks. var l=s.Length; can be int l=s.Length,q=2*l+1; and then you can replace all five 2*l+1 with q. (t+"\r\n") can be t+"\n". And these are basic golfing tips, I'm sure it can be golfed more.

As summary of the above suggestions (328 bytes); string W(string s){int l=s.Length,q=2*l+1,x=l,y=l,d=4,i=0,j,c;var a=new char[q,q];for(;i<l;){c=s[i]&~32;d=c==85?3:c==68?1:c==76?2:c==82?0:d;a[y,x]=s[i++];x+=d==0?1:d==2?-1:0;y+=d==1?1:d==3?-1:0;}string o="",t;for(i=0;i<q;i++){t="";for(j=0;j<q;)t+=a[i,j++]+"";o+=t==string.Join("",Enumerable.Repeat('\0',q))?"":t+"\n";}return o;}

Pyth, 68 65 bytes
KUJ,00ImXH~+VJ=@as_BM_MBU2Kx"rdlu"rd0dzjcsm.x@Hd;*Fm=Z}hdedSMCHlZ

Test suite
This uses a dictionary, indexed by a pair of coordinates, that is updated as the input read, then printed at the end. It also uses a ton of clever golfing tricks.
Here's how I wrote it, using the interpreter's -m flag to strip the whitespace and comments before running:
KUJ,00                 ; Initialize J to [0, 0] and K to [0, 1].
                       ; J is the current location, K is the current direction.
I                      ; If the following is truthy, which will be when the input
                       ; is nonempty,
  m                    ; Map d over z, the input.
  XH                   ; Assign to H (a hash table, initially empty)
    ~+VJ               ; At location J, then update J by adding elementwise
      =@               ; K (Next variable is implicit), which is set to
        as_BM_MBU2K    ; [0, 1], bifurcated on mapped negation, then mapped on
                       ; reversal bifuraction with the old value of K appended.
                       ; e.g. [[0, 1], [1, 0], [0, -1], [-1, 0], K]
        x"rdlu"rd0     ; indexed at location equal to the index of the lowercase
                       ; of the current character into "rdlu", -1 if missing.
    d                  ; Insert the current character with that key.
  z                    ; map over z.
jc                     ; Join on newlines the result of chopping into a rectangle
  sm                   ; the concatenation of the map
    .x@Hd;             ; Lookup the character at the given location,
                       ; if none then ' '
    *Fm                ; Locations are the cartesian product of the map
      =Z}hded          ; Inclusive range from the head of each list to
                       ; the end of each list
                       ; Saved in Z for later
      SMCH             ; Transpose the list of keys, and sort the x and y values
                       ; separately.
  lZ                   ; Width of the rectangle should equal the number of
                       ; x values, which is the length of the last entry.

JavaScript (ES6), 218 220 232
Edit I was using u and t to keep track of the top and leftmost position, but I realized that t is not needed at all
w=>[...w].map(c=>u=(((g[y]=g[y]||[])[x]=c,n=parseInt(c,36)|0)-21&&n-27?a=n-13?n-30?a:!(b=-1):!(b=1):(b=0,a=n/3-8),y+=b,x+=a)[...r.slice(u)].map(c=>z+=c||' ',z+=`
`),z='')&&z

Less golfed
w=>{
  a = 1, b = 0;
  x = y = u = w.length;
  g = [];
  [...w].map(c => (
    r = g[y]||[],
    r[x] = c,
    g[y] = r,
    n = parseInt(c,36)|0,
    n-21 && n-27 ? n-13 && n-30?0 : (a=0, b=n-13?-1:1) : (b=0, a=n/3-8),
    x += a, u = x[...r.slice(u)].map(c=>z += c||' ', z += '\n'))
  return z
}

Test

F=
w=>[...w].map(c=>u=(((g[y]=g[y]||[])[x]=c,n=parseInt(c,36)|0)-21&&n-27?a=n-13?n-30?a:!(b=-1):!(b=1):(b=0,a=n/3-8),y+=b,x+=a)[...r.slice(u)].map(c=>z+=c||' ',z+=`
`),z='')&&z

function update() {
  w=I.value
  O.textContent=F(w)
}

update()
#I {width:90%}
<input id=I value='It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words!' oninput='update()'>

05AB1E, 27 26 25 23 22 bytes
Saved 3 bytes thanks to Grimy
ā¤‹>Šε’uÏ‡’slkDÈiV}Y}Λ

Try it online!
Explanation
ā                        # push [1 ... len(input)]
 ¤‹                      # check each number if its less than the max
   >                     # increment
                         # results in a list as long as the input where each number is 2
                         # apart from the last one, this is the lengths to draw
    Š                    # move 2 copies of the input to the top of the stack
                         # the first one is the string to draw
     ε              }    # for each char in the second copy
      ’uÏ‡’slk           # get the chars index in "ubridal"
              D          # duplicate
               Èi }      # if the index is even
                 V       # store it in Y
                   Y     # push Y (initially 2)
                         # this gives us the list of directions
                     Λ   # draw everything on the canvas

"bridal" is a dictionary word. -1. EDIT: make that -2.

@Grimy: I wondered if the dictionary could be used here, but that's really smart!

22

Python 3, 314 309 290 268 Bytes
x=y=0
d,m=(1,0),{}
q={'u':(0,-1),'d':(0,1),'l':(-1,0),'r':d}
for c in input():m[x,y]=c;d=q.get(c.lower(),d);x,y=x+d[0],y+d[1]
X,Y=zip(*m)
O,P=min(X),min(Y)
r,p=0,print
exec("t=~~O;exec(\"p(m.get((t,r+P),' '),end='');t+=1;\"*-~abs(max(X)-O));r+=1;p();"*-~abs(max(Y)-P))

I tried running my program as input to my program with some interesting results. Hah, try interpreting that, Python!
Shaved 5 bytes - compliments to Jack Bates.
23 bytes whisked away by kundor
Note: I think there was some error of measurement with my bytes because of using different editors. However, I'm fairly certain the latest one is correct.

You can remove 5 bytes by replacing 'r':(1,0) with 'r':d and by removing the space at w[a] for. Also this is insane!!! How long did this take you?

@JackBates A day, in between work. I get a little obsessive.

Don't we all? That's the whole point of coding!

I believe you can replace that whole X,Y=map(...) line with X,Y=zip(*m). Works here.  (*m unpacks it to a list of its keys, and zip regroups them to two tuples.)

You can also put the for loop on one line to save four bytes.

My favourite part about this site is that I regularly learn new ways to terrorise my company's codebase.
I'll put in the one-line for loop but can someone first double-check my bytecount please? Note: I indented with tabs instead of spaces.

PHP, 238 223 205 204 bytes
12 bytes saved by Jörg (stripos instead of preg_match), 1 byte +braces by leading instead of trailing newline, 16+braces golfed from the direction change, 1 more with ternary instead of if.
for($m=$d=1;$o=ord($c=$argn[$i++]);$m=min($m,$x),$n=max($n,$x))stripos(_ulrd,$r[$y+=$e][$x+=$d]=$c)?$d=($e=[1,-1][$o&11])?0:$o%4-1:0;ksort($r);foreach($r as$s)for($i=$m-print"\n";$i++<$n;)echo$s[$i]??" ";

Run as pipe with php -nR '' or try it online.
breakdown
for($m=$d=1;                    # init max index and x-offset to 1
    $o=ord($c=$argn[$i++]);     # loop through characters
    $m=min($m,$x),$n=max($n,$x))    # 3. adjust min and max x offset
    stripos(_ulrd,
        $r[$y+=$e][$x+=$d]=$c       # 1. move cursor; add character to grid
    )?                              # 2. if direction change
        $d=(
            $e=[1,-1][$o&11]            # set y direction
        )
        ?0:$o%4-1                       # set x direction
    :0;

ksort($r);              # sort rows by index
foreach($r as$s)        # loop through rows
    for($i=$m-print"\n";    # print newline, reset $i
        $i++<$n;)           # loop $i from min index to max index
        echo$s[$i]??" ";        # print character, space if empty

If i see this right strspn($r[$y+=$e][$x+=$d]=$c,udlruDLR) should save some bytes instead of use the regex, ´stripos(_ulrd,$r[$y+=$e][$x+=$d]=$c)should e better as strspn$argn` save 3 Bytes

@JörgHülsermann Are you stalking me? :D You´re right.

No someone has edited his post today and I have seen your answer and I saw that you can make it shorter. Sorry about that the improvement is not so great that you can beat the JS answer. It makes happy and proud if I can find some bytes in your answers but I not searching this cases

@JörgHülsermann Don´t worry; I found another 21 bytes in addition to your 12. Thanks for making me revisit this.

Over 10 percent it is nice

Javascript, 4̶6̶6̶, 455, 433 Bytes
Edits:
11 Bytes saved, thanks to user 1000000000
10 or so saved, thanks to user2428118
Also removed some unnecessary semi-colons.
I'm pretty sure this can be golfed further, but i couldn't quite manage it.
I'm still new whole thing, so any advice is much appreciated :)

z=a=>{b=c=0;j=[[]];d='';a.split``.forEach(g=>{h=g.toLowerCase();if('ruld'.includes(h)){d=h}f=x=>new Array(x[0].length).fill` `;switch(d){case 'l':if(!b){j.forEach(e => e.unshift` `);++b}j[c][b--]=g;break;case 'u':if(!c){j.unshift(f(j));++c}j[c--][b]=g;break;case 'd':if(c == j.length-1){j.push(f(j))}j[c++][b]=g;break;default:if(b==(j[0].length-1)){j.forEach(row=>row.push` `)}j[c][b++] = g;break}});j.forEach(x=>console.log(x.join``))}
<input id="a"> </input>
<input type="submit" onclick="z(document.getElementById('a').value);"/>

Ungolfed:
z=a=>{
b=c=0;
j=[[]];
d='';
a.split``.forEach(g=>{
    h=g.toLowerCase();
    if('ruld'.includes(h)){d=h;}
    f=x=>new Array(x[0].length).fill` `;
    switch(d){
        case 'l':
            if(!b){
                j.forEach(e => e.unshift` `);
                ++b;
            }
            j[c][b--] = g;
            break;
        case 'u':
            if(!c){
                j.unshift(f(j));
                ++c;
            }
            j[c--][b] = g;
            break;
        case 'd':
            if(c == j.length-1){
                j.push(f(j));
            }
            j[c++][b] = g;
            break;
        default:
            if(b == (j[0].length-1)){
                j.forEach(row=>row.push` `);
            }
            j[c][b++] = g;
            break;
    }
});
j.forEach(x => console.log(x.join``));

}
I more or less took the approach of:

Have an array to store output
Calculate the x and y position of next character in the array
If the co-ordinates were about to be outside of the array, extend the array in that direction. Either by pushing and extra space onto the end of that row or adding another row entirely.
Make array[y][x] = current character
print the resulting array

Welcome to the site!  I'm not an expert in JavaScript but this looks pretty good.

Welcome! You can save 11 bytes by replacing ['r','u','l','d'] with "ruld"

Also you do not need the z= at the start of your program

Thanks for the tip! JS never ceases to amaze me with it's convenience.

You can use template literals at several places to  save some bytes, e.g. a.split`` .

Java 10, 288 286 280 263 bytes
s->{int l=s.length(),x=l,y=l,d=82,A=x,B=y;var r=new char[l+=l][l];for(var c:s.toCharArray()){A=x<A?x:A;B=y<B?y:B;r[x][y]=c;c&=~32;d="DLRU".contains(""+c)?c:d;x+=5-d/14;y+=3-(d^16)/23;}s="";for(x=A;x<l;x++,s+="\n")for(y=B;y<l;y++)s+=r[x][y]<1?32:r[x][y];return s;}

-17 bytes thanks to @Grimy.
Explanation:
Try it here. (NOTE: I remove all trailing spaces/newlines to make the output a bit more compact. Feel free to remove the .replaceAll("(m?)\\s+$","") in the test-method to see the actual result.)
s->{                              // Method with String as both parameter and return-type
  int l=s.length(),               //  Length of input String
      x=l,y=l,                    //  x,y coordinates, starting at `l`,`l`
      d=82,                       //  Direction, starting towards the right
      A=x,B=y;                    //  Min x & y values to remove leading spaces at the end
  var r=new char[l+=l][l];        //  character-matrix, with size `l`+`l` by `l`+`l`
  for(var c:s.toCharArray()){     //  Loop over the characters of the input String:
    A=x<A?x:A;                    //   Adjust minimum x `A` if necessary
    B=y<B?y:B;                    //   Adjust minimum y `B` if necessary
    r[x][y]=c;                    //   Fill x,y with the current character
    c&=~32;                       //   Make character uppercase if it isn't yet
    d="DLRU".contains(""+c)?c:d;  //   Change the direction if necessary
    x+=5-d/14;                    //   Set the next x coordinate based on the direction
    y+=3-(d^16)/23;}              //   Set the next y coordinate based on the direction
  s="";                           //  After the loop: create an empty result-String
  for(x=A;x<l;x++,                //  Loop `x` in the range [`A`, `l`):
      s+="\n")                    //    And append a new-line after every iteration
    for(y=B;y<l;y++)              //   Inner loop `y` in the range [`B`, `l`):
      s+=r[x][y]<1?               //    If the cell at x,y is empty:
          32                      //     Append a space to the result-String
         :r[x][y];                //    Else: append the character to the result-String
  return s;}                      //  After the nested loop: teturn result-String

d<69?1:d>84?-1:0 can be 5-d/14

And in the same vein, d==82?1:d==76?-1:0 can be 3-(d^16)/23

@Grimy Thanks. I knew those two parts could somehow be golfed, but I'm pretty bad at those bitwise/arithmetic transformations, so I didn't bother trying. Thanks for the -17 bytes! :)

Perl, 204 + 3 = 207 bytes
+3 for -F
Whitespace is not part of the code and is provided for legibility.
%p=(d,1,l,2,u,3,r,$x=$y=0);
for(@F){
    $m{"$x,$y"}=$_;
    $g=$p{lc$_}if/[dlur]/i;
    $g%2?($y+=2-$g):($x+=1-$g);
    ($a>$x?$a:$b<$x?$b:$x)=$x;
    ($c>$y?$c:$d<$y?$d:$y)=$y
}
for$k($c..$d){
    print($m{"$_,$k"}||$")for$a..$b;
    say""
}

Similar to my solution to the Fizz Buzz challenge, I create a hash with x,y coordinates for every step along the way, keeping the maximums and minimums of the x- and y- coordinates stored, then loop through and print everything out.
If I'm desperate I might be able to turn the last three lines of the first for loop into a single disgusting statement that may save a byte or two, but I'm not looking forward to the completely unreadable result.

Excel VBA, 205 bytes
Sub t(a)
Z=1:x=70:y=x:For i=1 To Len(a)
s=Mid(a,i,1):Cells(y,x).Value=s:Select Case LCase(s)
Case "l":Z=-1:w=0
Case "d":Z=0:w=1
Case "r":Z=1:w=0
Case "u":Z=0:w=-1
End Select:x=x+Z:y=y+w:Next:End Sub

I'm kinda surprised at Excel's ability to compete with existing answers. It works because w and z keep track of the direction.

starting position 70 could be not enough. Moreover, leading spaces are not allowed

SmileBASIC, 148 146 bytes
DEF W M,S,T
WHILE""<M
A=INSTR(@DLURdlur,M[0])*PI()/2IF A>0THEN S=COS(A)T=SIN(A)
X=CSRX+S
Y=CSRY+T?SHIFT(M);
SCROLL-!X,-!Y
LOCATE!X+X,Y+!Y
WEND
END

Call the function with W "text",vx,vy, where vx and vy is the direction at the start (default is 1,0)

What happens when X or Y is less than 0?

Now it will scroll all the text when the cursor goes offscreen.

Swift 3, 283 bytes
func w(a:String){var t=a.characters,d=t.count,c=Array(repeating:Array(repeating:" ",count:d*2),count:d*2),i=d,j=d,l=["d":(1,0),"u":(-1,0),"l":(0,-1),"r":(0,1)],e=(0,1)
t.map{c[i][j]="\($0)"
e=l["\($0)".lowercased()] ?? e
i+=e.0
j+=e.1}
c.map{$0.map{print($0,terminator:"")};print()}}

Ungolfed
func w(a:String){
    var t=a.characters,d=t.count,c=Array(repeating:Array(repeating:" ",count:d*2),count:d*2),i=d,j=d,l=["d":(1,0),"u":(-1,0),"l":(0,-1),"r":(0,1)],e=(0,1)
    t.map{
        c[i][j]="\($0)"
        e=l["\($0)".lowercased()] ?? e
        i+=e.0
        j+=e.1
    }
    c.map{
        $0.map{
            print($0,terminator:"")
        };
        print()
    }
}

Warning
Longer input will requires bigger screen. Output has no treatment for "empty" row/columns as I understood that is acceptable by the rules of the challenge.
Rant

Newline being the default terminator for print sux
No simple way of creating an array of known length destroyed the score.