text:
How did the chicken cross the road?
Cluck cluck. No one knows why the chicken crossed the road, maybe there was a good looking rooster on the other side. But we can figure out how. Write a program, that, left to right, crosses this (or any) "road".
1356 | 1738
3822 | 1424
3527   3718
9809 | 5926
0261 | 1947
7188   4717
6624 | 9836
4055 | 9164
2636   4927
5926 | 1964
3144 | 8254

Your program "crosses" it, moving left to right. You start on any number on the leftmost column you like. From there, you can move to any adjacent character to the right. If you started at the top left corner, 1, you could go to either 3 or 8. Every number you go to, including the starting number, is added to a sum. Spaces do not add to your sum. "|" forces you to move up or down, rather than somewhere to the right. (You CAN'T move forward on this character) Your goal is to get to the other side with the smallest possible sum. Your program must print out the sum at the end, and it must be able to solve any road. Preferably, it could also have input for a road, but it's not required. Your program must print both the path and the sum. Fewest bytes of code wins.
To clarify, you can move diagnally unless you are on a vertical bar. You can only move up and down when you are on a vertical bar.
For a clearer specification of roads, it is basically a string of text (Or an array of columns or rows, should you prefer to think that way) that follows the rules of the characters, and there can't be anything BUT those characters in the road. There can be any number, a space, a bar ("|"), or a newline. If a road was paved by a drunk guy, as in ProgrammerDan's answer, it is still a valid road, and your program must be able to solve such a road. It is not considered a road if it is impossible to get to the other side (For example, there is no way out of a straight line of bars).
Your program is not required to determine if a road is invalid.
Key:
Any number - adds the number to your sum, move forward.
Space - Move forward, nothing is added to your sum.
"|" - Move up or down, nothing is added to your sum.
EDIT:
An example solution, as suggested. I can't make a horribly big one, I can't get on an IDE to solve it for me ATM.
Take this small road:
9191 | 8282
1919 | 2727
5555   5555

The solution would be a path of 1, 1, 1, 1, space, divider, divider, space, space, 2, 2, 2, 2 for a total of 12.
EDIT #2:
The solution to the first road on this question, as determined by Geobits and peoples programs, is 0,2,0,1, , , ,1,4,1,4 for a sum of 13.

Could you include at least one test case with a correct solution? Also, could there be more than three | in a row?

Yes, as long is there is a space somewhere on the line. I'm on a mobile device ATM, so I can't write a program to find the solution for me. I'll post a solution to the current example when I can get on an IDE.

When you say you can move to either 3 or 8 from the 1, does this include the 3 below the 1? Or can we not move straight up or down unless we're left-adjacent to a vertical bar?

If I'm understanding this correctly, for example, the upper-right 1738 will never have the 1 be touched, because the chicken's "path" will exit the space at the 3 and the 1 isn't adjacent to the space, right?

@mbomb you can only move straight down when you're on a vertical bar.

@timmy you can move diagonally, as long as it is moving forward. It can be touched with a couple of diagonal movements.

To be clear, it doesn't matter if your path has more spaces/bars than necessary at all? Like in your example, you could avoid the bar altogether with diagonal movement and get the same sum with one less "move".

Correct, spaces/bars do not affect your sum. Moves don't matter.

@mbomb007 If starting at the top corner. Since you can start on any in the left column, you can get 0,2,0,1, , , ,1,4,1,4 -> 13

Since it looks like you can walk up/down on the spaces, it doesn't really matter where the gaps in the vertical line are, does it?

Yes, it does. You can only move up or down on the bars, so you can only get out of them through a space.

Are "roads" a fixed width of 4 per side?  If not, are both sides always equal width?

@Brian No, there is no set width.

For the output, simply the cost suffices, or does the entire path need to be output?

@ProgrammerDan it has to output both.

Are we guaranteed that the | pieces will all line up with each other?

In your small test example, I don't see how you can do it with just three spaces while following the rules. Doesn't it take four?

@dfeuer fixed it.

And also @dfeuer no, it is not grunted to line up. Perhaps the guy painting the lines was drunk.

Another question: Is the road guaranteed to be the same width everywhere, or might different lines in the input have different lengths?

Nope. The only things that are certain is the rules of the characters.

Mean, I love it! Looking forward to some excellent answers emerging.

Pyth, 168 143 141 bytes [now Drunken Road compatible]
My test case works, but because of a misunderstanding on my part, it won't work properly with the initial example.  I'm working on fixing it.
Now working for original example and drunken roads
Some REALLY slightly less ugly code:
=Z.dC,++\ `MUT\|++0UT=^T5Ltu+G]?&qeeG\|<heGhH+eGeHHtb,0hbKhohNum++hed@ZhhdtedC,H_y_y.b+N]YmhohNd.:++TGT3HCm.[d\ lh.MlZ.z.z*hl.z]]0j\,t.sK\ hK

Test it Here
I tested it on a 10+9 x 40 road.
6417443208|153287613
8540978161|726772300
7294922506 263609552
0341937695 498453099
9417989188 370992778
2952186385|750207767
7049868670 756968872
1961508589|379453595
0670474005 070712970
4817414691|670379248
0297779413|980515509
6637598208 090265179
6872950638 767270459
7375626432 439957105
1387683792|544956696
6974831376 545603884
0949220671|632555651
3952970630|379291361
0456363431|275612955
2973230054|830527885
5328382365|989887310
4034587060 614168216
4487052014|969272974
5015479667 744253705
5756698090|621187161
9444814561|169429694
7697999461|477558331
3822442188 206942845
2787118311|141642208
2669534759 308252645
6121516963|554616321
5509428225|681372307
6619817314|310054531
1759758306 453053985
9356970729|868811209
4208830142 806643228
0898841529|102183632
9692682718|103744380
5839709581|790845206
7264919369|982096148

Just a note, getting a "IndexError: list index out of range" when running using the test suite provided.

@ProgrammerDan so do I.

@ProgrammerDan Are you using the test link? "Compiler last updated: 21 Sep 2015 UTC"  I've tried in FireFox and Chrome, both with the link and copy/pasting. I'd really like to figure this out, so any help would be appreciated.

@BrianTuck Not sure what changed, but is working now.

For what it's worth, I made a change to Pyth that might have broken things ~12 hours ago, and reverted it ~4 hours ago.

Your answer and mine match.

@BrianTuck taking OP literally, the road rows might not all be the same length, and might not all start or end with numbers. I've put an example with my code illustrating this and its effect, I'd love to see a Pyth way of addressing it!

It doesn't seem to like ProgrammerDan's drunk road.

@CaffeineToCode true, but the concept of a "drunk road" was added after I submitted. It would have been helpful to have known what constituted a road. Based on the examples I assumed 2 sides with a dividing column

@BrianTuck I didn't specify that they had dividing columns, only the keys. Granted I should have. This is actually my first Code Golf question. I've learned a lot from this.

@CaffeineToCode One of the best ways to write a good question is just to write more examples -- even without solution. If variable width or multi-lane roads were valid, one "crazy" example would have illustrated it without any additional descriptive text.

@CaffeineToCode It's a fun first question. Sorry for my complaining, but I'm new to Pyth and have little experience with functional programming. Rewriting my program was quite a task, and I'm a bit daunted by the thought of rewriting it again.

@ProgrammerDan You asked for it. Mine is now DR-compatible (and shorter... guess I'm catching on)

Java, 955 bytes
Obviously not going to win any awards, being Java and all, but I love this problem and wanted to throw in my own entry.
Features and limits:

Can support irregular roads (super drunk!) including variable widths, complex lines, etc.
Expects road to be input as parameters on execution; the ungolfed version also supports reading from stdin, but since input method wasn't specified the golfed version expects smallest!
Uses some dynamic programming technique I haven't used in, oh, 6 years or so to efficiently solve in O(n*m) time, where n is rows and m is columns.

Solves from right to left, marking the best direction to take from the current index to the next index.
"lines" are handled by resolving their column, then addressing them if reachable on the next column over. They resolve by storing direction up or down, with the cost of the eventually reachable non-line.

Tracks, but doesn't print (in golf'd version) the starting index of the best solution.

Ok, enough jibba jabba. Golfed version:
class C{public static void main(String[]a){int n=a.length,m=0,i=0,j=0,h=0,p=0,q=0,s=0,t=0,b=-1,c=2147483647,x=0,y=0;char[][]r=new char[n][];char u;for(String k:a){j=k.length();m=(j>m)?j:m;}for(String k:a)r[i++]=java.util.Arrays.copyOf(k.toCharArray(),m);int[][][]d=new int[n][m][2];for(j=m-1;j>=0;j--){for(i=0;i<n;i++){u=r[i][j];p=(u=='\0'||u==' '||u=='|'?0:u-'0');if(j==m-1)d[i][j][1]=p;else{if(u=='|')d[i][j][0]=-1;else{for(h=-1;h<2;h++){x=i+h;y=j+1;if(x>=0&&x<n){if(d[x][y][0]==-1){s=x-1;while(s>=0&&r[s][y]=='|')s--;t=x+1;while(t<n&&r[t][y]=='|')t++;if((s>=0&&t<n&&d[s][y][1]<d[t][y][1])||(s>=0&&t>=n)){t=d[s][y][1];s=4;}else{s=6;t=d[t][y][1];}d[x][y][0]=s;d[x][y][1]=t;}q=d[x][y][1]+p;if(d[i][j][0]==0||q<d[i][j][1]){d[i][j][0]=h+2;d[i][j][1]=q;}}}}}if(j==0&&(b<0||d[i][j][1]<c)){b=i;c=d[i][j][1];}}}String o="";i=b;j=0;while(j<m){u=r[i][j];if(u=='\0')j=m;else{o+=u+",";h=d[i][j][0]-2;if(h>1)i+=h-3;else{i+=h;j++;}}}System.out.println(o+"\b:"+c);}}

As per my habit, github with the ungolfed code.
Solution for "first" road:
$ java C "1356 | 1738" "3822 | 1424" "3527   3718" "9809 | 5926" "0261 | 1947" "7188   4717" "6624 | 9836" "4055 | 9164" "2636   4927" "5926 | 1964" "3144 | 8254"
0,2,0,1, , , ,1,4,1,4:13

Second example:
$ java C "9191 | 8282" "1919 | 2727" "5555   5555"
1,1,1,1, ,|,|, , ,2,2,2,2:12

Brian Tuck's sample:
$ java C "6417443208|153287613" "8540978161|726772300" "7294922506 263609552" "0341937695 498453099" "9417989188 370992778" "2952186385|750207767" "7049868670 756968872" "1961508589|379453595" "0670474005 070712970" "4817414691|670379248" "0297779413|980515509" "6637598208 090265179" "6872950638 767270459" "7375626432 439957105" "1387683792|544956696" "6974831376 545603884" "0949220671|632555651" "3952970630|379291361" "0456363431|275612955" "2973230054|830527885" "5328382365|989887310" "4034587060 614168216" "4487052014|969272974" "5015479667 744253705" "5756698090|621187161" "9444814561|169429694" "7697999461|477558331" "3822442188 206942845" "2787118311|141642208" "2669534759 308252645" "6121516963|554616321" "5509428225|681372307" "6619817314|310054531" "1759758306 453053985" "9356970729|868811209" "4208830142 806643228" "0898841529|102183632" "9692682718|103744380" "5839709581|790845206" "7264919369|982096148"
2,1,0,1,5,1,2,1,1,1, ,1,0,1,2,1,2,3,0,1:26

"Drunkified" Brian's example:

6417443208|153287613
8540978161|726772300
7294922506 263609552
0341937695 498453099
9417989188 370992778
2952186385|750207767
7049868670 756968872
1961508589|379453595
0670474005 070712970
4817414691|670379248
0297779413|980515509
6637598208 090265179
6872950638 767270459
7375626432 439957105
1387683792|544956
697483176 5456034
09492201|6325551
395297030|3792913
 456363431|275612
  73230054|830527885
    8382365|989887310
    4587060 614168216
  87052014|96927297
 50479667 7442537
57566980 | 621187161
944481456 | 169429694
7697999461|477558331
3822442188 206942845
2787118311|141642208
2669534759 308252645
6121516963|554616321
5509428225|681372307
6619817314|310054531
1759758306 453053985
9356970729|868811209
4208830142 806643228
0898841529|102183632
9692682718|103744380
5839709581|790845206
7264919369|982096148

$ java C "6417443208|153287613" "8540978161|726772300" "7294922506 263609552" "0341937695 498453099" "9417989188 370992778" "2952186385|750207767" "7049868670 756968872" "1961508589|379453595" "0670474005 070712970" "4817414691|670379248" "0297779413|980515509" "6637598208 090265179" "6872950638 767270459" "7375626432 439957105" "1387683792|544956" "697483176 5456034" "09492201|6325551" "395297030|3792913" " 456363431|275612" "  73230054|830527885" "    8382365|989887310" "    4587060 614168216" "  87052014|96927297" " 50479667 7442537" "57566980 | 621187161" "944481456 | 169429694" "7697999461|477558331" "3822442188 206942845" "2787118311|141642208" "2669534759 308252645" "6121516963|554616321" "5509428225|681372307" "6619817314|310054531" "1759758306 453053985" "9356970729|868811209" "4208830142 806643228" "0898841529|102183632" "9692682718|103744380" "5839709581|790845206" "7264919369|982096148"
 , , , ,0,5,2,0,1, , , ,1,1,1,3,2:16

Solution visualized:

09492201|6325551
395297030|3792913
\456363431|275612
 \73230054|830527885
  \ 8382365|989887310
   \4\87060 614168216
  87/5--\4|96927\97
 50479667\74425/7
57566980 |\62-/87161
944481456 |\/69429694
7697999461|477558331

Enjoy!
Edit: Now I'm just showing off (two roadways merge! Can he make it?)

948384 | 4288324   324324 | 121323
120390 | 1232133   598732 | 123844
 293009 | 2394023 432099 | 230943
 234882 | 2340909 843893 | 849728
  238984 | 328498984328 | 230949
  509093 | 904389823787 | 439898
   438989 | 3489889344 | 438984
   989789 | 7568945968 | 989455
    568956 | 56985869 | 568956
    988596 | 98569887 | 769865
     769879 | 769078 | 678977
     679856 | 568967 | 658957
      988798 | 8776 | 987979
      987878 | 9899 | 989899
       999889 |    | 989899
       989999 |    | 989999
        989898 |  | 998999
        989999 |  | 999999
         989998 || 899999
         989998 || 998999

Solution:
$ java C "948384 | 4288324   324324 | 121323" "120390 | 1232133   598732 | 123844" " 293009 | 2394023 432099 | 230943" " 234882 | 2340909 843893 | 849728" "  238984 | 328498984328 | 230949" "  509093 | 904389823787 | 439898" "   438989 | 3489889344 | 438984" "   989789 | 7568945968 | 989455" "    568956 | 56985869 | 568956" "    988596 | 98569887 | 769865" "     769879 | 769078 | 678977" "     679856 | 568967 | 658957" "      988798 | 8776 | 987979" "      987878 | 9899 | 989899" "       999889 |    | 989899" "       989999 |    | 989999" "        989898 |  | 998999" "        989999 |  | 999999" "         989998 || 899999" "         989998 || 998999"
 ,2,0,3,0,0, ,|,|, ,|,|, ,|,|, ,|,|, ,|,|, ,|,|, ,|,|, , , , , , , ,|, ,|, ,|, ,|, ,|, ,|, ,|,|, , ,1,0,7,2:15

(bonus: path from ungolfed):
$ java Chicken < test5.txt
best start: 3 cost: 15
  -> 2 -> 0 -> 3 -> 0 -> 0 ->   -> | -> | ->   -> | -> | ->   -> | -> | ->   -> | -> | ->   -> | -> | ->   -> | -> | ->
  -> | -> | ->   ->   ->   ->   ->   ->   ->   -> | ->   -> | ->   -> | ->   -> | ->   -> | ->   -> | ->   -> | -> | ->
  ->   -> 1 -> 0 -> 7 -> 2 -> 15
/ -> - -> - -> \ -> / -> / -> - -> , -> , -> - -> , -> , -> - -> , -> , -> - -> , -> , -> - -> , -> , -> - -> , -> , ->
- -> , -> , -> / -> \ -> - -> - -> - -> / -> / -> ^ -> / -> ^ -> / -> ^ -> / -> ^ -> / -> ^ -> / -> ^ -> / -> , -> , ->
/ -> - -> \ -> \ -> - -> \ -> across

Details on Algorithm
A more complete explanation of the Dynamic Programming technique I employed was requested, so here goes:
I'm using a mark-and-precompute method of solution. It has a proper name, but I've long since forgotten it; perhaps someone else can offer it?
Algorithm:

Starting at the right-most column and progressing to the left, compute the following about each cell in the column:

The summation of lowest cost movement, defined as current cell cost + lowest cost cell reachable in the next column
The movement action to take to achieve this lowest cost, as simply a valid move from this cell to another single cell.

Pipes are deferred. To resolve a pipe, you need to have the full column computed, so we don't compute pipes until the next column.

When determining the lowest cost of a cell to the left of a pipe, we first compute the best direction to travel along the pipe -- it will always resolve to either up, or down, so we compute it once.
We then store, as with all other cells, the best cost (defined as the cost of the cell we reach by travelling either up or down on the pipe) and the direction to travel to reach it.

Notes:
That's it. We scan from top to bottom, right to left, once; the only cells touched (potentially) more then once are pipes, however, each pipe is only "solved" once, keeping us within our O(m*n) window.
To handle "odd" map sizes, I chose to simply pre-scan and normalize lengths of rows by padding with null characters. Null characters count as "zero cost" moves same as pipes and spaces. Then, in printing the solution, I stop printing costs or moves when either the edge of the normalized road is reached, or a null character is reached.
The beauty of this algorithm is it's very simple, applies the same rules to every cell, producing a full solution by solving O(m*n) sub-problems, and in terms of speed is rather fast. It does trade off memory, creating effectively two copies in memory of the roadway map, the first to store "best cost" data and the second to store "best move" data per cell; this is typical for dynamic programming.

Could you explain your approach to lines a bit more? I also attempted a (somewhat different) dynamic programming approach, but got stuck figuring those out. I've also considered an incremental (row by row) approach to deal with extremely long roads that are not too wide without using too much memory; do you know if there's a way to do that in under O(m^2*n) time?

@dfeuer It's all about the tradeoffs, to be sure. None of the row-by-row approaches I considered were able to handle all permutations of input without succumbing to O(m^n) time at some point; this is a column-by-column problem by construction (movement, largely, goes from left-to-right -- efficient DP solution goes from right-to-left).
You might be able to do an O(m*n) approach solving row-by-row with simple look-behind and deferred look ahead, but you're greatly increasing complexity without likely saving a lot of memory.

What I was thinking was that if I'm not mistaken you need only keep track of the best path thus far and, for each square in the most recently processed row, the best known paths from the left edge, to the right edge, and to each square to its right in the same row. Is that wrong?

I've added an explanation. The technique I use is far simpler; it's a purely cell-local solver. You only need to know the best route leading out of each cell, each cell doesn't need to know the best way to get to it, only the best way to leave. Once you have all those computed, assuming you've kept track of the cost as you've gone, you can simply pick the "lowest cost" starting position as you've already computed the total, best route, cost.

Thanks! You can shorten your code a drop by defining c as -1>>>1.

Awesome, I'll toss that change up tonight. Good luck with your implementation! What language are you targeting, if you don't mind spoiling a little? :)

I'm targeting Haskell, which will make it hard to compete for length, but it's what I know best by far.

@ProgrammerDan My method is similar, but progresses left-to-right. I wonder if right-to-left would make it easier to handle lines

@BrianTuck Hard to say. I know in my "thinkings" LTR didn't work, because you make local decisions on incomplete knowledge, whereas RTL makes local decisions on complete knowledge. LTR without full lookahead (enumeration) will make locally-optimal decisions but potentially poor global decisions; so RTL in my thinking is superior. TL;DR -- LTR is a poly-time estimator (inaccurate but fast); RTL is a poly-time solver (accurate and fast). In either case you'd need a way to "normalize" line length.

@ProgrammerDan Since Pyth works best for functional programming, I couldn't really use a matrix-based approach, so I basically use a complex reduce function on the list of columns.


text:
Shuffling evenly
Some trading cards have real value and can be sold for money. Bending the cards is frowned upon because it takes away their value and makes them look less new. Say you have a deck of trading cards (Pokemon, Magic, etc.) and you want to shuffle them. Instead of doing the bridge that bends all of the cards, another simple way to shuffle cards is to put them into piles. Here's what I mean.
Background
With a 60 card deck in need of shuffling, you could separate the 60 cards into three piles of 20 cards. There are multiple ways to do this, the most plain being to put a card into pile A, then one into pile B, then one into pile C. Another way is to put a card into pile C, then B, then A. There are also ways to spread the cards across the piles unevenly. Here's one: put a card in pile A, put another card in A, then put a card in pile B, then put a card in pile C.
Challenge
Create a full program that will output even if a certain way to shuffle into piles spreads the cards in the piles evenly, and outputs uneven and the number of cards in each pile otherwise.
Input
Input will be taken through STDIN or the closest alternative (no functions).
[sequence] [deck size]

sequence is a string of characters. It tells the pattern the cards are laid down into the piles. Each different character corresponds to a single pile. This string will always be under the deck size and will contain only capital letters A-Z.
deck size is an integer that specifies how many cards are in the deck. If deck size is 60, the number of cards in the deck is 60.

Output
even

If the number of cards in each pile at the end of the shuffle are the same, your program should output this.
uneven [pile1] [pile2] [...]

If the number cards in each pile at the end of the shuffles are the not the same, your program should output uneven and the number of cards in each pile like this: uneven 20 30 if pile A contains 20 canrds and pile B contains 30. The order of the pile numbers does not matter.
Other information

This is a code golf challenge, so the shortest code in bytes on September 25 wins. If there is a tie in byte counts, the code that was submitted first wins.
Your program must be a program, not a function.
If possible, please include a link to an online interpreter or a link to a place where I can download an interpreter for your language in your answer.
Anything I do not specify within this challenge is fair game, meaning if I don't say it, it's up to you. If anything is vague, tell me and I will edit the answer accordingly. (Hopefully this goes more smoothly than my last challenge.)

Examples
     Input | Output | Alternate outputs (if uneven)
           |
    ABC 30 | even
    ABC 31 | uneven 11 10 10 | uneven 10 11 10 | uneven 10 10 11
    BCA 60 | even
    BBA 24 | uneven 8 16 | uneven 16 8
ABACBC 120 | even
  BBABA 50 | uneven 20 30 | uneven 30 20
  AABBB 12 | even

I don't understand what sequence looks like or how it works. Could you please add some test cases?

@xnor Yes, adding now.

...I am never playing cards with you. :P

@ThomasKwa Input should be taken through standard input or the closest alternative.

Is ABDD 12 a valid input? What should be the output? Also, do I understand right that AABBB 12 is even?

Yes and yes. ABDD 12 could output uneven 3 3 6 or uneven 3 6 3 or uneven 6 3 3 (the order does not matter).

if you're only pile shuffling at magic events be prepared to get a stern talking to

@undergroundmonorail Figured, since it isn't actually random. Lol

Pyth, 33 31 bytes
jd+>"uneven"yK!tl{J/L@LzQ{z*J!K

Example input:
ABACBC
120

Python 3.x, 106 128 138 bytes
s,n=input().split()
n=int(n)
t=(s*n)[:n]
*z,=map(t.count,set(t))
b=z[:-1]!=z[1:];print("un"*b+"even",*z*b)

This duplicates the input sequence (more times than needed, which is good enough) and then takes only the first n characters. These are counted and either uneven or even is chosen, and if the former, the counts also are printed with print(*z), which automatically unpacks z for me.
Saved 32 bytes thanks to xnor and Sp3000!
Also, Python 3.5 has a new feature that allows this 102 byte solution:
s,n=input().split()
n=int(n)
t=(s*n)[:n]
*z,=map(t.count,{*t})
b=len({*z})>1;print("un"*b+"even",*z*b)

len({*z})>1 unpacks the list z, makes a set from it, then checks to see if it has more than one element. It is {*z} specifically that's new.

Happy to see a new Python golfer! Some quick tips. The list comp [t.count(x) for x in set(t)] can be done as a map: map(t.count,set(t)). The question allows the piles in any order, so I think you can avoid doing sorted, even if it means you have to do something a bit longer than z==z[::-1] like z[1:]==z[:-1].

Also, Python 3 lets you print* to print the elements of a list space-separated. This is usually shorter than ' '.join.

@xnor: Much appreciated!

CJam, 35 bytes
rri_@*<$e`0f=_)-"uneven":Ua@+S*U2>?

Try it online in the CJam interpreter.
How it works
rri      e# Read a string (s) and an integer (n) from STDIN.
_@       e# Push a copy of n and rotate s on top of it.
*        e# Repeat s n times.
<        e# Keep only the first n characters.
$e`      e# Sort and perform run-length encoding.
0f=      e# Keep only the multiplicities.
_)-      e# Push a copy, pop the last element and remove its remaining occurrences.
         e# The result with be an empty array (falsy) iff all elements are equal.
"uneven" e# Push that string.
:Ua      e# Save it in U and wrap it in an array.
@+       e# Concatenate ["uneven"] with the array of multiplicities.
S*       e# Join, separating by spaces.
U2>      e# Push "even".
?        e# Select the result depending on whether _)- pushed an empty array.

source: Stack Exchange

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

sort: votes


text:
A Sine of Greatness
Introduction
Everyone's heard of sine (sin), cosine (cos), tangent (tan), cotangent (cot), secant (sec), and cosecant (csc). Nearly every angle  has them.
Far less known, or remembered, are the exsecant (exsec), excosecant (excsc), versine (versin), and coversine (cvs). Nearly every angle has those as well. There are some that are even less known, but we'll just stick to these.
I've created a visualization of these for angle θ, which is 45°.

The Challenge
Create a program that takes an input of an angle n, in degrees, and will output:

the sine of angle n
the cosine of angle n
the tangent of angle n
the secant of angle n
at least one of the following. Every additional item from this list will earn a bonus -5%, for a maximum of -25%.

exsecant of angle n
cosecant of angle n
excosecant of angle n
versine of angle n
coversine of angle n
cotangent of angle n

If your score is a decimal after applying a bonus, round up to the nearest whole number.

Input
You may accept your input through STDIN or through a function call. A single argument, n, will be passed.
n will always be a whole integer that is greater than 0, but less than or equal to 90.

Output
Here is an example of the output for sine of 45°. All output items must be in this format. The order of the items does not matter.
sine: 0.70710678118

All items must have exactly 4 numbers after the decimal (precision to the ten-thousandths). Below are a few examples of rounding.
0 -> 0.0000
1 -> 1.0000
0.2588190451 -> 0.2588
5.67128181962 -> 5.6713
10 -> 10.0000
12.4661204396 -> 12.4661

Any nonexistent/undefined results should default to 0.

Example
myprogram(60)

sine: 0.8660
cosine: 0.5000
tangent: 1.7321
secant: 2.0000
exsecant: 1.0000
cosecant: 1.1547
excosecant: 0.1547
versine: 0.5000
coversine: 0.1340
cotangent: 0.5774

Scoreboard
For your score to appear on the board, it should be in this format:
# Language, Score

Or if you earned a bonus:
# Language, Score (Bytes - Bonus%)

Strikethroughs shouldn't cause a problem.

function getURL(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){$.ajax({url:getURL(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),useData(answers)}})}function getOwnerName(e){return e.owner.display_name}function useData(e){var s=[];e.forEach(function(e){var a=e.body.replace(/<s>.*<\/s>/,"").replace(/.*<\/strike>/,"");console.log(a),VALID_HEAD.test(a)&&s.push({user:getOwnerName(e),language:a.match(VALID_HEAD)[1],score:+a.match(VALID_HEAD)[2],link:e.share_link})}),s.sort(function(e,s){var a=e.score,r=s.score;return a-r}),s.forEach(function(e,s){var a=$("#score-template").html();a=a.replace("{{RANK}}",s+1+"").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SCORE}}",e.score),a=$(a),$("#scores").append(a)})}var QUESTION_ID=58283,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],answer_ids,answers_hash,answer_page=1;getAnswers();var VALID_HEAD=/<h\d>([^\n,]*)[, ]*(\d+).*<\/h\d>/;
body{text-align:left!important}table thead{font-weight:700}table td{padding:10px 0 0 30px}#scores-cont{padding:10px;width:600px}#scores tr td:first-of-type{padding-left:0}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Scores

	User	Language	Score

{{RANK}}	{{NAME}}	{{LANGUAGE}}	{{SCORE}}

Does the order of the output matter?

Pedantry ahead: "Every angle has them" - not true; odd multiples of 90 degrees don't have a tangent, for example. (It seems extremely bizarre to me that you require nonexisting values to give an output of zero. Would you really use a program that deliberately gave such misleading answers?) Also, I'd be interested to know why you regard the cosecant and cotangent as being more obscure than the secant; in my A-level maths classes we learned about those three at the same time.

Is capitalization fixed lowercase? I'd like output 'Sine, Cosine ...'

Hard to understand Full program vs  input through a function call

Is the angle input really greater than 0, so 0 is not allowed?

I am probably misreading, but I need some clarifications. As you say a program than can output ..., that means that I may or may not print those items. All I need to print is one of the at least at point 5. If I'm wrong, please clarify...

I've modified the question. To answer your question, you must output sine, cosine, tangent, secant, and at least one item from the list at #5. Every additional item from the list at #5 constitutes a bonus -5%. @edc65

I'm assuming builtins are allowed?

Yes they are. @ASCIIThenANSI

It looks like there are a lot of answers who do not convert to radians (input is supposed to be in degrees, right?) or handle the 90° case as prescribed (I cannot say I agree with returning 0, but still).

CJam, 94 89 85 81 80 bytes
"sine tangent secant"S/{"co"1$+}%rd90/_i33Yb@[P*2/__ms\mc@mt]_Wf#W%+?.{d": %.4f"e%N}

The code is 84 bytes long and qualifies for a 5% bonus (cotangent and cosecant).
Try it online in the CJam interpreter.
How it works
"sine tangent secant" e# Push that string.
S/                    e# Split it at spaces.
{"co"1$+}%            e# For each chunk, append a copy to the string "co", pushing
                      e# ["sine" "cosine" "tangent" "cotangent" "secant" "cosecant"].
rd90/                 e# Read a Double from STDIN and divide it by 90.
_i                    e# Push a copy and cast it to integer.
33Yb                  e# Push 33 in base 2, i.e., [1 0 0 0 0 1].
@                     e# Rotate the Double on top of the stack.
[                     e#
  P*2/                e# Multiply by Pi and divide by 2.
  __                  e# Push two copies of the result.
  ms                  e# Compute the sine of the topmost copy.
  \mc                 e# Swap and compute the cosine of the next copy.
  @mt                 e# Rotate and compute the tangent of the original.
 ]                    e#
 _Wf#                 e# Copy the array and raise all Doubles to the power -1.
                      e# This computes cosecant, secant and cotangent.
 W%                   e# Reverse their order.
 +                    e# Append to the original array.
 ?                    e# Select 33Yb if the integer part of the input divided by 90 is
                      e# (i.e., if the input is 90), the constructed array otherwise.
 .{                   e# For each function name and result:
   d                  e# Cast to Double (needed for 33Yb).
   ": %.4f"           e# Push a format string containing ": " and a 4-decimal float.
   e%                 e# Apply the formatting to the Double on the stack.
   N                  e# Push a linefeed.
 }                    e#

Julia, 162 - 10% = 144 bytes
n->for z=zip(split("sine cosine tangent secant exsecant cosecant cotangent"),[sind,cosd,tand,secd,i->secd(i)-1,cscd,cotd]) @printf("%s: %.4f\n",z[1],z[2](n))end

Ungolfed:
function f(n)
    # Construct a vector of names
    s = split("sine cosine tangent secant exsecant cosecant cotangent")

    # Construct a vector of functions
    o = [sind, cosd, tand, secd, i -> secd(i) - 1, cscd, cotd]

    # Print each in a loop
    for z = zip(s, o)
        @printf("%s: %.4f\n", z[1], z[2](n))
    end
end

Is it me or your "Unfolded" version has an additional loop?

You'd be better off without exsecant and cotangent.

@DavidArenburg The longer version has the same number of loops, it's just written differently than the short version.

@ThomasKwa I know, but I'm not going to win anyway. :P

Pyth, 66 - 10% = 59.4 bytes
j+V+Jc"sine secant tangent")+L"co"Jsmm%": %.4f"^.t.td7k^_1k3,Q-90Q

Calculates the sine, secant and tangent. Then, the co- functions are simply calculated via the formula coF(x) = F(90 - x).

Does this give 0 for undefined?

@ThomasKwa Don't think so.

Then it is currently invalid.

Mathematica (Invalid at the moment), 134 121 104
Just for fun, surely it can be golfed down a lot
f[n_]:=(a={Sin,Cos,Tan,Sec,Cot,Csc};TableForm[N[#@n,4]&/@a,TableHeadings->{ToString[#]<>":"&/@a,None}])

And it should have a 5% bonus (Cot and Csc), therefore amounting at 99 characters
Example output:

Wouldn't you get a better score by adding more functions?

@proud haskeller, I can try, but probably I will lose more than gain characters

Does this write the names of the functions out in full, or use 0 for sec(90)?

@Thomas Kwa it shouldn't, I'll test it when I have a chance

I really doubt this show actual function names

@DavidArenburg see edit, this is what it outputs

So the output isn't correct. It should output the full names as per OPs question. I.e., sine: , cosine: , etc. Also, you aren't rounding to the fourth digit. All the numbers should have 4 digits after the dot. See example output per one of the answer in this thread

@DavidArenburg fair enough, I'll add a version which does as soon as I can

JavaScript (ES6), 173 (182 - 5%)
Edit revised after clarification, now the bonus is 5%
Edit realized that the angle can not be 0

// TEST - redefine alert
alert=x=>O.innerHTML=x

r=(a=prompt(i=0))*(M=Math).PI/180,V=_=>[s=M.sin(r),c=M.cos(r),(f=a-90)&&s/c,c/s,f&&1/c,1/s][i++].toFixed(4);
alert(`sine
tangent
secant`.replace(/.+/g,h=>h+`: ${V()}
co${h}: ${V()}`))

/* More bonus, but too longer
r=(a=prompt(i=0))*(M=Math).PI/180,V=_=>[s=M.sin(r),c=M.cos(r),1-c,1-s,(f=a-90)&&s/c,c/s,f&&1/c,1/s][i++].toFixed(4);
alert(`sine
versine
tangent
secant`.replace(/.+/g,h=>h+`: ${V()}
co${h}: ${V()}`))
*/

Javascript ES6, 154 148 (198 - 25%)
(n=0)=>[S='sine',(O='co')+S,T='tangent',C='secant',X=O+C,O+T,V='ver'+S,O+V,'ex'+C,'ex'+X].map((q,i)=>q+': '+[s=Math.sin(n),c=Math.cos(n),t=s/c,e=1/c,o=1/s,1/t,1-c,1-s,e-1,o-1][i].toFixed(4)).join`
`

Ungolfed:
(n=0)=>          // function declaration, accepts number, defaults to 0
  [              // create array of trig function names
    S='sine',    // sine
    (O='co')+S,  // cosine
    T='tangent', // tangent
    C='secant',  // secant
    X=O+C,       // cosecant
    O+T,         // cotangent
    V='ver'+S,   // versine
    O+V,         // coversine
    'ex'+C,      // exsecant
    'ex'+X       // excosecant
  ].map((q,i)=>  // map over names
                 // append ": <value rounded to 4 decimals>" to function name:
    q+': '+[s=Math.sin(n),c=Math.cos(n),t=s/c,e=1/c,o=1/s,1/t,1-c,1-s,e-1,o-1][i].toFixed(4)
  ).join`        // add newline between each function
`

Could you add a comma after "Javascript ES6" in your title so your score will parse correctly?

R, 122 136 134 bytes
n=scan()*pi/180;write(paste0(c("sine","cosine","tangent","secant","versine"),sprintf(": %.4f",c(sin(n),r<-cos(n),tan(n),1/r,1-r))),"")

Example usage
> n=scan()*pi/180;write(paste0(c("sine","cosine","tangent","secant","versine"),sprintf(": %.4f",c(sin(n),r<-cos(n),tan(n),1/r,1-r))),"")
1: 60
2:
Read 1 item
sine: 0.8660
cosine: 0.5000
tangent: 1.7321
secant: 2.0000
versine: 0.5000

scan()/(180/pi) -> scan()*pi/180?

Python 3, 282 (375 - 25%)
Error handling turned out to be somewhat complicated by floating-point errors; namely, cos(90) came out to a very small number instead of zero.
It's never going to be the top answer, but I like to think it might be the shortest valid all-functions answer in a non-golfy language that doesn't have the trig functions in the default namespace. ;-)
import math as m
def p(q,r):print(q+':','%.4f'%r)
def a(n):
 n=n*m.pi/180
 C,S=round(m.cos(n),8),m.sin(n)
 A=S,1,0,C,1,S,C,0,C,S,1,C,0,1,S,1,C,-1,1,S,C,1,1,S,1
 def t():
  nonlocal A;u,v,w,x,y,*A=A;z=-1 if w>0 else 1
  try:return z*u/v+w,z*x/y+w
  except:return 0,0
 def q(y,x=''):J,K=t();p(x+y,J);p(x+'co'+y,K)
 q('sine');q('tangent');s='secant';q(s);q(s,'ex');q('versine')

Sample output:
>>> a(60)
sine: 0.8660
cosine: 0.5000
tangent: 1.7321
cotangent: 0.5774
secant: 2.0000
cosecant: 1.1547
exsecant: 1.0000
excosecant: 0.1547
versine: 0.5000
coversine: 0.1340

wouldn't '.4f'%(r) be shorter?

@xebtl: Thanks. I tend to forget that %-formatting still exists!

Perl, 182 177 (236 - 25%)
Run with -n (1 byte added to uncorrected score).
$b=$_==90;$_/=57.296;$c=cos;$s=sin;sub f{printf"%s: %.4f\n",@_}$T=tangent;f$T,$b?0:$s/$c;f co.$T,$c/$s;$S=sine;f $S,$s;f co.$S,$c;$C=secant;f$C,$b?0:1/$c;f co.$C,1/$s;f ex.$C,$b?0:1-1/$c;f exco.$C,1/$s-1;$V=ver.$S;f$V,1-$c;f co.$V,1-$s

Nothing fancy.  It takes advantage of -n for implicit input, $_ as a default argument to sin and cos, and barewords for strings.  The “undefined = 0” rule is hardcoded in using the ternary operator ?: (it applies only for 90°).
One thing I learend is that apparently, you cannot have (or cannot call) a subroutine named s (or m, y, tr): sub s {print 1}; s yields Substitution pattern not terminated at -e line 1.

For some reason, your score is parsed even weirder.

Could you add a comma after "Perl" so your score is parsed correctly?

Perl, 165 (193 - 15%)
I am submit this a s a new answer because the idea is quite different from the other one.  Please let me know if it is more appropriate to replace my first attempt.
$p=atan2 1,0;$b=$_-90;%h=qw(sine $s tangent $b?$s/$c:0 secant $b?1/$c:0 versine 1-$c);$_/=90/$p;sub e{$c=cos;$s=sin}e;sub f{eval"printf'$x$_: %.4f
',$h{$_}"for keys%h}f;$b=1;$_=$p-$_;e;$x=co;f

Run with -n (1 byte added).
Ungolfed:
# π/2
$p=atan2 1,0;

# trouble?
$b=$_-90;

# Construct a hash whose keys are the “base” function names,
# and whose values are the corresponding expressions in terms of sin and cos
%h=qw(sine $s tangent $b?$s/$c:0 secant $b?1/$c:0 versine 1-$c);

# Thanks to ‘-n’, input is in $_; convert to radians
$_/=90/$p;

# Compute sin and cos in a reusable way
sub e{$c=cos;$s=sin}
e;

sub f {
   eval "printf '$x$_: %.4f
', $h{$_}"
      for keys %h
}

f;

# Now the “co” functions
# No trouble here
$b=1;

# x ← π/2 - x
$_=$p-$_;

e;
$x=co;
f

Since it does the four “co”-functions, I think it qualifies for a 3*5% = 15% bonus.

Perl, 100 95 94 bytes
Whoa, lotta perl answers.
$_=<>;printf"sine: %.4f\ncosine: %.4f\ntangent: %.4f\nsecant: %.4f\n",sin,cos,(sin)/cos,1/cos

Yeah, and you are doing pretty well with this straightforward approach :-).  You can shave off some bytes by using -n (counts for 1 byte) instead of $_=<>.  However, you have to convert from degrees to radians, and you do not handle the 90° case as prescribed. (With the latter, it seems like you are hardly alone among the answers here.)

Also, remember that the ancestor of Code Golf was Perl Golf :-)

I'm a little confused here... this uses radians. Was I supposed to use degrees?

Haskell, 159 = 186 - 15% bytes
s x=zipWith(\a b->a++": "++show b)(concatMap(\n->[n,"co"++n])$words"sine tangent versine secant")$map($(x*pi/180))[sin,cos,t,(1/).t,(1-).cos,(1-).sin,e.t,e.(1/).t]
e=sqrt.(+1).(^2)
t=tan

No ex-thingies to keep my clever naming scheme and since I didn't know how to shorten (\x->x-1). (-1) is just a number.
Please complain if you want me to prettify (mapM_ putStrLn) the lines.

Thanks! Same for Alex A. and @orlp. The latter should maybe round up the net score.

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


text:
Counting the Endpoints of an ASCII Art
You should write a program or function which receives a string representing an ASCII art as input and outputs or returns the number of endpoints in the input.
The input will consist of the characters space - | + (with 0, 2, 2 and 4 endpoints respectively) and linebreaks. E.g.:
-|++-
  +

Two adjacent characters are connected and hence lose 1 endpoint each in the following cases:
--  -+  +- |  |  +  +  ++
           |  +  |  +

The first example has
2+2+2+2+1+
    3        = 12

endpoints.
Input

Input will be a string consisting of the characters space, -, |, + and newline.
Input length can be 0 length and any input matching the above description is valid (in regex input is [ -+|\n]*).
Trailing newline is optional.

Output

A single non-negative integer, the number of endpoints.

Examples
Outputs are after the last row of their inputs.
+
4

-|++-
  +
12

+--+
|  |
+--+
8

  |  |
  +--+-- |||
12

--++
 |||--
10

<empty input>
0

|
|
2

--
++--
 ++
   --+
  +++ ||

 ----
30

This is code golf so the shortest entry wins.

Snails, 29
A
\+|\-)lr!\-|(\+|\|)n!\|}!\+

I added line comments with ,,, in order to make a commented version.
A                    ,, Count all accepting paths
        \+ | \- )    ,, Literal '+' or '-'
        lr           ,, Set direction to left or right
        !\-          ,, Assert next char is not '-'
    |                ,, Or...
        ( \+ | \| )  ,, Literal '+' or '|'
        n            ,, Turn 90 degrees right or left (from initial direction right)
        !\|          ,, Assert next char is not '|'
}                    ,, Group everything previous
!\+                  ,, Assert next char is not '+'

JavaScript (ES6), 168
Using template strings, all newlines are significant and counted.
Test running the snippet below in Firefox. (Chrome still does not support ...)

f=s=>`
${s}
`.split`
`.map((r,y,s,v=c=>c>' '&c!='-',h=c=>c>' '&c<'|')=>[...r].map((c,x)=>t+=(v(c)?2-v(s[y-1][x])-v(s[y+1][x]):0)+(h(c)?2-h(r[x-1])-h(r[x+1]):0)),t=0)&&t

// Less golfed
u=s=>{
  s = ('\n' + s + '\n').split('\n'); // split in rows, adding a blank line at top and one at bottom
  t = 0; // init counter
  v = c => c>' ' & c!='-'; // function to check if a character has vertical end points
  h = c => c>' ' & c<'|'; // function to check if a character has horizontal end points
  s.forEach( (r,y) =>
    [...r].forEach( (c,x) => {
     if (v(c)) // if current character has vertical endpoints, check chars in previous and following row
        t += 2 - v(s[y-1][x]) - v(s[y+1][x]);
     if (h(c))  // if current character has horizontal endpoints, check previous and following chars in row
        t += 2 - h(r[x-1]) - h(r[x+1]);
    })
  )
  return t
}

//TEST
out=x=>O.innerHTML+=x+'\n'

;[
 [`+`,4]
,[`-|++-
  +`,12]
,[`+--+
|  |
+--+`,8]
,[`  |  |
  +--+-- |||`,12]
,[`--++
 |||--`,10]
,[``,0]
,[`
|
|`,2]
,[`
--
++--
 ++
   --+
  +++ ||

 ----`,30]
].forEach(t=>{ r=f(t[0]),k=t[1],out('Test '+(r==k?'OK':'Fail')+'\n'+t[0]+'\nResult:'+r+'\nCheck:'+k+'\n') })

What I need to do is splitting s in rows, then add an empty row at top and an empty row at bottom. Your code does not split s at all. You could do ["",...s.split("\n"),""] that is longer @ETHproductions

Ah, right, sorry about that.

CJam, 66 62 61 bytes
q_N/_z,S*f.e|zN*"-|++"2$fe=1b"|-"{'++:R:a@+2ew{aR2m*&},,-}/2*

Try it online in the CJam interpreter.
Idea
We can compute the endpoints as follows:

Count the number of -s, |s and +s in the input.
Multiply the last one by 2 and add the results.
Count the number of --s, -+s, +-s and ++s in the rows.
Count the number of ||s. |+s, +|s and ++s in the columns.
Subtract the results from 3 and 4 from the result from 2.
Multiply the result from 5 by 2.

Code
q        e# Read all input from STDIN.
_N/      e# Push a copy and split it at linefeeds.
_z,      e# Count the number of rows of the transposed array.
         e# This pushes the length of the longest row.
S*       e# Push a string of that many spaces.
f.e|     e# Perform vectorized logical OR with the rows.
         e# This pads all rows to the same length.
zN*      e# Transpose and join, separating by linefeeds.
"-|++"   e# Push that string.
2$       e# Copy the original input.
fe=      e# Count the occurrences of '-', '|', '+' and '+' in the input.
1b       e# Add the results.
"|-"{    e# For '|' and '-':
  '++    e#   Concatenate the char with '+'.
  :R     e#   Save the resulting string in R.
  :a     e#   Convert it into an array of singleton strings.
  @      e#   Rotate one of the two bottom-most strings on top of the stack.
         e#   This gets the transposed input for '|' and the original input for '-'.
  +      e#   Concatenate both arrays.
         e#   This pads the input with nonsense to a length of at least 2.
  2ew    e#   Push a overlapping slices of length 2.
  {      e#   Filter the slices; for each:
    a    e#     Wrap it in an array.
    R2m* e#     Push the second Cartesian power of R.
         e#     For '|', this pushes ["||" "|+" "+|" "++"].
    &    e#     Intersect.
  },     e#   If the intersection was non-empty, keep the slice.
  ,      e#   Count the kept slices.
  -      e#   Subtract the amount from the integer on the stack.
}/       e#
2*       e# Multiply the result by 2.

Python 2, 123
l=[]
i=p=t=0
for c in input():
 l+=0,;h=c in'-+';t+=h>p;p=h;v=c in'|+';t+=v>l[i];l[i]=v;i+=1
 if' '>c:l=l[:i];i=0
print t*2

A one-pass method. Takes as input a string with linebreaks.
For the horizontals, the idea is to count the number of horizontal segments, each of which has two endpoints. A segment starts whenever a character is one of +- (boolean h) but the previous one isn't (boolean p).
For the verticals, we'd like to do the same thing on the transposed input, looking at runs of +|. Unfortunately, Python's transposing is really clunky. It requires something like map(None,*s.split('\n')) to fill in the blanks with None, which are also themselves to deal with.
Instead, we do the vertical count while iterating horizontally. We keep a list l of which columns indices are still "running", i.e. where that the previous character in that column connects down. Then, we do the same thing as with the horizontal, counting newly starting vertical segments. When we hit a newline, we cut off the list right of where we are, since all segments to the right were broken, and reset the current index to 0.


text:
Avast, ye scallywags!
Blackbeard was an English pirate of the early 18th century. Although he was known for looting and taking ships, he commanded his vessels with the permission of their crews. There are no accounts of him ever harming or murdering his captives.
This challenge is in honor of the infamous Blackbeard and inspired by International Talk Like a Pirate Day (September 19). It is also the inverse of this challenge by Pyrrha.

The Challenge
Create a program that takes a treasure map as an input (composed of the characters listed below), and outputs it's directions.

Input
All inputs will consist of v, >, <, ^, whitespace, and a single X.
You can assume the following:

the map will never loop or cross itself
the starting arrow will always be the bottommost character in the leftmost column
there will always be a treasure (X)

A sample input is shown below.
  >>v   >>>>>>v
  ^ v   ^     v
  ^ v   ^   v<<
  ^ v   ^   v
  ^ >>>>^   >>X
  ^
>>^

Output
The output should be a ", "-delimited string of directions. Below is the correct output from the above map.
E2, N6, E2, S4, E4, N4, E6, S2, W2, S2, E2

A single trailing newline or space is permitted.

Examples
In:
>>>>>>>>>>>>>>>v
               v
               v
               >>>>X

Out:
E15, S3, E4

In:
>>>>>>v
^     v
^     >>>>X

Out:
N2, E6, S2, E4

In:
X
^
^
^

Out:
N3

In:
>>>>>>v
^     v
^     v
      v
      >>>>>>X

Out:
N2, E6, S4, E6

In:
 X
 ^
 ^
>^

Out:
E1, N3

In:
>X

Out:
E1

In:
v<<<<<
vX<<<^
>>>>^^
>>>>>^

Out:
E5, N3, W5, S2, E4, N1, W3

Happy International Talk Like a Pirate Day!

You may want to include an example where there's more than one right-pointing arrow in the left-most column, i.e. where the path loops back into the first column. In that case, it's slightly tricky to identify the start of the path.

I've added an example per your request. I've also added the detail that the starting character will be the bottommost of the column. @RetoKoradi

Since I raised some concern in the related question about the length of the last segment, I'll nitpick once again and say that this is not exactly the reverse question here. Someone is trying to trick the pirates once again, me thinks.

The only difference is the step count of the last direction. @coredump At least, as far as I can tell.

In the second example, shouldn't it be E6 instead of E7?

Ah, you're correct. I've fixed it. @RetoKoradi

@ZachGates Yes, exactly (and just to be clear, I am not saying that the question should be modified, it is good as it currently is).

CJam, 78 bytes
qN/_:,$W=:Tf{Se]}s:U,T-{_U="><^vX"#"1+'E1-'WT-'NT+'S0"4/=~_@\}g;;]e`{(+}%", "*

Try it online.
Explanation
The main idea here is to find the longest line (we'll call this length T), then pad all lines to the same length and concatenate them (this new string is U). This way only a single counter is needed to move in the map. Adding/subtracting 1 means moving to the right/left in the same line, adding/subtracting T means moving down/up one line.
qN/    e# Split the input on newlines
_:,    e# Push a list of the line lengths
$W=:T  e# Grab the maximum length and assign to T
f{Se]} e# Right-pad each line with spaces to length T
s:U    e# Concatenate lines and assign to U

Now it's time to set up the loop.
,T-    e# Push len(U) - T
       e# i.e. position of first char of the last line
{...}g e# Do-while loop
       e# Pops condition at the end of each iteration

The loop body uses a lookup table and eval to choose what to do. At the beginning of each iteration, the top stack element is the current position. Underneath it there are all the processed NSWE directions. At the end of the iteration, the new direction is placed underneath the position and a copy of it is used as the condition for the loop. Non-zero characters are truthy. When an X is encountered, 0 is pushed as the direction, terminating the loop.
_U=      e# Push the character in the current position
"><^vx"# e# Find the index in "><^Vx"
"..."4/  e# Push the string and split every 4 chars
         e# This pushes the following list:
         e# [0] (index '>'): "1+'E" pos + 1, push 'E'
         e# [1] (index '<'): "1-'W" pos - 1, push 'W'
         e# [2] (index '^'): "T-'N" pos - T, push 'N'
         e# [3] (index 'v'): "T+'S" pos + T, push 'S'
         e# [4] (index 'X'): "0"    push 0
=~       e# Get element at index and eval
_@\      e# From stack: [old_directions position new_direction]
         e# To stack: [old_directions new_direction position new_direction]
         e# (You could also use \1$)
         e# new_direction becomes the while condition and is popped off

Now the stack looks like this: [directions 0 position]. Let's generate the output.
;;    e# Pop position and 0 off the stack
]     e# Wrap directions in a list
e`    e# Run length encode directions
      e# Each element is [num_repetitions character]
{     e# For each element:
 (+   e#   Swap num_repetitions and character
}%    e# End of map (wraps in list)
", "* e# Join by comma and space

CJam, 86 bytes
qN/_,{1$=cS-},W=0{_3$3$==_'X-}{"^v<>"#_"NSWE"=L\+:L;"\(\ \)\ ( )"S/=~}w];Le`{(+}%", "*

Try it online
Explanation:
qN/     Get input and split into rows.
_,      Calculate number of rows.
{       Loop over row indices.
  1$=     Get row at the index.
  c       Get first character.
  S-      Compare with space.
},      End of filter. The result is a list of row indices that do not start with space.
W=      Get last one. This is the row index of the start character.
0       Column number of start position. Ready to start tracing now.
{       Start of condition in main tracing loop.
  _3$3$   Copy map and current position.
  ==      Extract character at current position.
  _'X-    Check if it's the end character `X.
}       End of loop condition.
{       Start of loop body. Move to next character.
  "^v<>"  List of directions.
  #       Find character at current position in list of directions.
  _       Copy direction index.
  "NSWE"  Matching direction letters.
  =       Look up direction letter.
  L\+:L;  Append it to directions stored in variable L.
  "\(\ \)\ ( )"
          Space separated list of commands needed to move to next position for each of
          the 4 possible directions.
  S/      Split it at spaces.
  =       Extract the commands for the current direction.
  ~       Evaluate it.
}w      End of while loop for tracking.
];      Discard stack content. The path was stored in variable L.
Le`     Get list of directions in variable L, and RLE it.
{       Loop over the RLE entries.
  (+      Swap from [length character] to [character length].
}%      End of loop over RLE entries.
", "*   Join them with commas.

Javascript (ES6), 239 bytes
a=>(b=a.split`
`,b.reverse().some((c,d)=>c[0]!=' '&&((e=d)||1)),j=[],eval("for(g=b[e][f=0];b[e][f]!='X';g=b[e][f],j.push('NSEW'['^v><'.indexOf(i)]+h))for(h=0;g==b[e][f];e+=((i=b[e][f])=='^')-(i=='v'),f+=(i=='>')-(i=='<'),h++);j.join`, `"))

Explanation:
a=>(
    b = a.split('\n'),
    // loops through list from bottom to find arrow
    b.reverse().some(
        (c, d)=>
            // if the leftmost character is not a space, saves the index and exit
            // the loop
            // in case d == 0, the ||1 makes sure the loop is exited
            c[0] != ' ' && ((e = d) || 1)
    ),
    j = [], // array that will hold the instructions
    eval("  // uses eval to allow a for loop in a lambda without 'return' and {}

        // loops through all sequences of the same character
        // e is the first coordinate of the current character being analyzed
        // f is the second coordinate
        // defines g as the character repeated in the sequence
        // operates on reversed b to avoid using a second reverse
        // flips ^ and v to compensate

        for(g = b[e][f = 0];
            b[e][f] != 'X'; // keep finding sequences until it finds the X
            g = b[e][f],    // update the sequence character when it hits the start of a
                            // new sequence
            j.push('NSEW'['^v><'.indexOf(i)] + h)) // find the direction the sequence is
                                                   // pointing to and add the
                                                   // instruction to j

            // loops through a single sequence until it hits the next one
            // counts the length in h
            for(h = 0;
                g == b[e][f]; // loops until there is a character that isn't part of
                              // the sequence
                // updates e and f based on which direction the sequence is pointing
                // sets them so that b[e][f] is now the character being pointed toward
                e += ((i = b[e][f]) == '^') - (i == 'v'),
                f += (i == '>') - (i == '<'),
                // increments the length counter h for each character of the sequence
                h++);

            // return a comma separated string of the instructions
            j.join`, `
    ")
)

JavaScript(ES6), 189
Test running the snippet below in an EcmaScript 6 compliant browser.

f=m=>{(m=m.split`
`).map((r,i)=>r[0]>' '?y=i:0);for(x=o=l=k=p=0;p!='X';++l,y+=(k==1)-(k<1),x+=(k>2)-(k==2))c=m[y][x],c!=p?(o+=', '+'NSWE'[k]+l,l=0):0,k='^v<>'.search(p=c);alert(o.slice(7))}

// Testable version, no output but return (same size)
f=m=>{(m=m.split`
`).map((r,i)=>r[0]>' '?y=i:0);for(x=o=l=k=p=0;p!='X';++l,y+=(k==1)-(k<1),x+=(k>2)-(k==2))c=m[y][x],c!=p?(o+=', '+'NSWE'[k]+l,l=0):0,k='^v<>'.search(p=c);return o.slice(7)}

// TEST
out = x => O.innerHTML += x+'\n';

test =
[[`>>>>>>>>>>>>>>>v
               v
               v
               >>>>X`,'E15, S3, E4']
,[`>>>>>>v
^     v
^     >>>>X`,'N2, E6, S2, E4']
,[`X
^
^
^`,'N3']
,[`>>>>>>v
^     v
^     v
      v
      >>>>>>X`,'N2, E6, S4, E6']
,[` X
 ^
 ^
>^`,'E1, N3']
,[`>X`,'E1']
,[`v<<<<<
vX<<<^
>>>>^^
>>>>>^`,'E5, N3, W5, S2, E4, N1, W3']];

test.forEach(t=>{
  var k = t[1];
  var r = f(t[0]);
  out('Test ' + (k==r ? 'OK' : 'Fail')
      +'\n'+t[0]+'\nResult: '+r
      +'\nCheck:  '+k+'\n');
})

Less golfed
f=m=>{
  m=m.split('\n'); // split in rows

  x = 0; // Starting column is 0
  m.forEach( (r,i) => r[0]>' '? y=i : 0); // find starting row

  o = 0; // output string
  p = 0; // preceding character
  l = 0; //  sequence length (this starting value is useless as will be cutted at last step)
  k = 0; //  direction (this starting value is useless as will be cutted at last step)
  while(p != 'X') // loop until X found
  {
    c = m[y][x]; // current character in c
    if (c != p) // changing direction
    {
      o +=', '+'NSWE'[k]+l; // add current direction and length to output
      l = 0 // reset length
    );
    p = c;
    k = '^v<>'.search(c); // get new current direction
    // (the special character ^ is purposedly in first position)
    ++l; // increase sequence length
    y += (k==1)-(k<1); // change y depending on direction
    x += (k>2)-(k==2); // change x depending on direction
  }
  alert(o.slice(7)); // output o, cutting the useless first part
}


text:
The Truck Problem
I am a teacher who was given a problem a few years ago. Every year since I have given it to my advanced students as a bonus assignment, but in ~10 years only 8 solved it, each with a slightly different approach. The problem is as follows:
You have some input (from stdin), in the following format (the //comments are not included in the input):
6      //Route Begin
1 2    //Route data...
1 3
3 4
3 5
4 6
5 6
2 3
2 4
0 0    //Route end
4      //Route Begin
2 3    //Route Data...
3 4
5 1
1 6
7 8
8 9
2 5
5 7
3 1
1 8
4 6
6 9
0 0    //Route end
// continued...

The input begins with the destination, an integer. It is followed by a 'map' of all streets in the city. Each line represents a connection, so you can get from street 1 to street 2, and vice-versa. On every rout you start at street 1, then work your way to your destination.
The objective: List all possible routes, and tell the user the shortest one (least amount of street changes).
Also, the code beads to be human readable.
 So you would wont to output something like:
Destination 1 (6):
1 2 3 4 6
1 2 3 5 6
1 2 4 3 5 6
1 2 4 6
1 3 2 4 6
1 3 4 6
1 3 5 6
There are 7 routes from the truck station to street 6.
The shortest of these is the route "1 2 4 6", with 4 streets.

Destination 2 (4):
1 3 2 5 7 8 9 6 4
1 3 4
1 5 2 3 4
1 5 7 8 9 6 4
1 6 4
1 6 9 8 7 5 2 3 4
1 8 7 5 2 3 4
1 8 9 6 4
There are 8 routes from the truck station to street 4.
The shortest of these is the route "1 3 4", with 3 streets.

Now personally, I rather java or python (and java is preferred more), but I leave this open ended to my students, so they can choose any language they like.
The original document is here
HOW TO WIN: Create the described program in a readable programming language, with the following criteria:
- Readable
- takes the input from the user(stdin/file)
- Is mildly easy to understand.

This is probably not a good challenge to be a [popularity-contest]; it works extremely well as a [code-golf]. It's not related to [sorting], either.

Note that this is a [tag:path-finding] problem. It's a lot like this.

@Justin And the river question, and the arrow question, and the loop question etc.

Also, while you mention Java and Python, their tags are not relevant to this question.

@justin I didn't wan't it to be a short answer. I lost my answer and don't want to figure it out again.

@tawilson there needs to be an objective winning criteria so perhaps forming it into a code-challenge could work

Welcome to Programming Puzzles & Code Golf! In spite of what the Q&A format may suggest, this site is for programming challenges, which require an objective winning criterion. A challenge cannot be both code golf (shortest code wins) and a popularity contest (most upvoted answer wins), since the criteria contradict each other.

I have fixed it

@tawilson You have added criteria, but they aren't objective. "Readable" and "Is mildly easy to understand" are identical and subjective. What if two answers are posted that both solve your problem? Then what? This site is a Q&A style, but the idea is to post challenges out there that people can solve whenever they come across it. Shortest code is a pretty good criteria, as it allows us to objectively find a winning answer. Most answerers have an un-minified version of their code as well, which they post along with an explanation.

I guess I am unfamiliar with this stack exchange website. How should I word it then?

I find it very hard to believe that a teacher for 10 years would take more than 5 minutes to solve this incredibly easy problem. I also find it incredibly worrying only 8 of your students managed to solve it.

Its a small High school. Also, I just haven't had the time to figure it out again. Besides, it is nice to see other ppls algorithms.

Javascript (1159)

function h(g,e){var b=[],d=0,c=null,f=0;g.split("\n").forEach(function(a){a=a.replace(/\s*\/\/.*?$/,"");switch(d){case 0:c={};f=a;d++;break;case 1:a=a.split(" "),"0"===a[0]&&"0"===a[1]?(b.push(c),a=[],k(f,c,null,null,a),e.push([f,a]),d=0):(c[a[0]]||(c[a[0]]=[]),c[a[1]]||(c[a[1]]=[]),c[a[0]].push(a[1]),c[a[1]].push(a[0]))}})}
function k(g,e,b,d,c){b||(b="1",d=[]);d.push(b);var f=[];if(g!=b){if(e[b].forEach(function(a){-1==d.indexOf(a)&&(a=k(g,e,a,d.slice(),c))&&f.push(a)}),f.length)return f}else return c.push(d),d}
(function(g,z){var e=[];h(g,e);e.forEach(function(b){document.write("Destination "+b[0]+z);var d=99,c=-1;b[1].forEach(function(b,a){document.write(b.join(", ")+z);b.length<d&&(d=b.length,c=a)});document.write("There are "+b[1].length+" routes from the fire station to street "+b[0]+z);document.write('The shortest of these is the route "'+b[1][c].join(" ")+'", with '+d+" streets"+z)})})("6      //Route Begin\n1 2    //Route data...\n1 3\n3 4\n3 5\n4 6\n5 6\n2 3\n2 4\n0 0    //Route end\n4      //Route Begin\n2 3    //Route Data...\n3 4\n5 1\n1 6\n7 8\n8 9\n2 5\n5 7\n3 1\n1 8\n4 6\n6 9\n0 0    //Route end\n// continued...\n","<br>");

notes:

Just used "regular" javascript code, then minified it using Closure
Compiler
Route data embedded, could have been alot shorter without a "parser". That would mean the data should be JSON encoded ..

Unminified version (added per request):
function parseInput(input, data)
{
    var output = [];
    var lines = input.split("\n");
    var state = 0;
    var route = null;
    var routeDest = 0;
    lines.forEach(function(val){
        val = val.replace(/\s*\/\/.*?$/, "");

        switch(state)
        {
            case 0:
                route = {};
                routeDest = val;
                state++
            break;
            case 1:
                var conn = val.split(" ");
                if (conn[0] === "0" && conn[1] === "0")
                {
                    output.push(route);
                    var innerData = [];
                    calculateRoutes(routeDest, route, null, null, innerData);
                    data.push([routeDest, innerData]);
                    state = 0;
                }
                else
                {
                    if (!route[conn[0]])
                    {
                        route[conn[0]]=[]
                    }
                    if (!route[conn[1]])
                    {
                        route[conn[1]]=[]
                    }

                    route[conn[0]].push(conn[1]);
                    route[conn[1]].push(conn[0]);
                }
            break;
        }
    });

    return output;
}

function calculateRoutes(dest, data, curr, from, returnData)
{
    if (!curr)
    {
        curr = "1";
        from = [];
    }

    from.push(curr);

    var routes = [];

    if (dest != curr)
    {
        data[curr].forEach(function(val){
            if (from.indexOf(val) == -1)
            {
                var route = calculateRoutes(dest, data, val, from.slice(), returnData);
                if (route)
                {
                    routes.push(route);
                }
            }
        });

        if (routes.length)
        {
            return routes;
        }
    }
    else
    {
        returnData.push(from);
        return from;
    }
}

function printRoutes(routeInfo)
{
    var data = [];
    parseInput(routeInfo, data);

    data.forEach(function(val){
        console.log("Destination " + val[0]);
        var shortLen = 99;
        var shortId = -1;
        val[1].forEach(function(ele, id){
            console.log(ele.join(", "));
            if (ele.length < shortLen)
            {
                shortLen = ele.length;
                shortId = id;
            }
        });
        console.log("There are " + val[1].length + " routes from the fire station to street " + val[0]);
        console.log("The shortest of these is the route \"" + val[1][shortId].join(" ") + "\", with " + shortLen + " streets");
    });
}

var nl = "\n"

printRoutes("6      //Route Begin" + nl +
    "1 2    //Route data..." + nl +
    "1 3" + nl +
    "3 4" + nl +
    "3 5" + nl +
    "4 6" + nl +
    "5 6" + nl +
    "2 3" + nl +
    "2 4" + nl +
    "0 0    //Route end" + nl +
    "4      //Route Begin" + nl +
    "2 3    //Route Data..." + nl +
    "3 4" + nl +
    "5 1" + nl +
    "1 6" + nl +
    "7 8" + nl +
    "8 9" + nl +
    "2 5" + nl +
    "5 7" + nl +
    "3 1" + nl +
    "1 8" + nl +
    "4 6" + nl +
    "6 9" + nl +
    "0 0    //Route end" + nl +
    "// continued..." + nl);

The unminified version uses console.log for output instead of document.write. Because document.write gives a better experience as a code snippet than console.log.

Could I see the decompressed version?


text:
Bounce Dynamics
The Challenge
Write a program that can calculate how many times and how long a ball will bounce based on a few input variables.

Input
There are three variables that will be passed. You can accept these however you like (user input, function call, etc). The variables are as follows:

height
velocity
"bounciness"

They must be passed in this order.

Height
Height will be expressed as an integer, H, where 10^6 ≥ H ≥ 10. The height is measured in arbitrary units, u, which have no effect on your program's output.

Velocity
The velocity of the ball will be represented by an integer, V, where 10^6 ≥ V ≥ 1. It is expressed as Vu/s (V units per second).

Bounciness
The "bounciness" will be expressed as a decimal, B, where 0.00 ≤ B < 1.00. The maximum precision of B will be the hundredths place (two digits after the decimal point).

Output
You output will be two integers representing:

number of times the ball will bounce before coming to rest, N
how long it takes the ball to complete all of these bounces, T

Calculation
To calculate the number of times the ball will bounce, you would continuously multiply the current height by the "bounciness" until it dipped below 1. Once the result gets below 1, you should round the height down to 0, and stop calculating.
Each time these two are multiplied, the time is incremented by the quotient of the current height and velocity.
Intermediary calculations should have a minimum precision to the ten-thousandths (four digits after the decimal).

Example 1
If the input is:
10 10 0.5

The following table shows the necessary calculations for each bounce:
Height          Next       Height             Bounces
------        -------      ------             -------
10.0000       10.0000    *   0.5    = 5.0000        1
 5.0000        5.0000    *   0.5    = 2.5000        1
 2.5000        2.5000    *   0.5    = 1.2500        1
 1.2500        1.2500    *   0.5    = 0.6250        1

                                              -------
                                Total Bounces:      4

   Time added
----------------
10.0000    /  10   =   1.0000
 5.0000    /  10   =   0.5000
 2.5000    /  10   =   0.2500
 1.2500    /  10   =   0.1250

                       ------
           Total Time: 1.8750

At this point, the computation terminates because the height is less than 1. The time is rounded up to yield 2. These two integers should then either be returned or output as a string in this form:
4 2

Example 2
If the input is:
50 15 0.7

The following table shows the necessary calculations for each bounce:
Height      Next                  Height     Bounces
------     -------                -------    -------
50.0000    50.0000  *   0.7    =  35.0000          1
35.0000    35.0000  *   0.7    =  24.5000          1
24.5000    24.5000  *   0.7    =  17.1500          1
17.1500    17.2500  *   0.7    =  12.0050          1
12.0050    12.0050  *   0.7    =   8.4035          1
 8.4035     8.4035  *   0.7    =   5.8825          1
 5.8825     5.8825  *   0.7    =   4.1177          1
 4.1177     4.1177  *   0.7    =   2.8824          1
 2.8824     2.8824  *   0.7    =   2.0177          1
 2.0177     2.0177  *   0.7    =   1.4124          1
 1.4124     1.4124  *   0.7    =   0.9887          1

                                            --------
                              Total Bounces:      11

Time added
-----------
50.0000    /  15   =     3.3333
35.0000    /  15   =     2.3333
24.5000    /  15   =     1.6333
17.1500    /  15   =     1.1433
12.0050    /  15   =     0.8003
 8.4035    /  15   =     0.5602
 5.8825    /  15   =     0.3922
 4.1177    /  15   =     0.2745
 2.8824    /  15   =     0.1922
 2.0177    /  15   =     0.1345
 1.4124    /  15   =     0.0942

                     ----------
          Total Time:   10.8913

At this point, the computation terminates because the height is less than 1. The time is rounded up to give 11. These two integers should then either be returned or output as a string in this form:
11 11

Scoreboard
For your score to appear on the board, it should be in this format:
# Language, Score

Or if you earned a bonus:
# Language, Score (Bytes - Bonus%)

function getURL(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){$.ajax({url:getURL(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),useData(answers)}})}function getOwnerName(e){return e.owner.display_name}function useData(e){var s=[];e.forEach(function(e){var a=e.body.replace(/<s>.*<\/s>/,"").replace(/.*<\/strike>/,"");console.log(a),VALID_HEAD.test(a)&&s.push({user:getOwnerName(e),language:a.match(VALID_HEAD)[1],score:+a.match(VALID_HEAD)[2],link:e.share_link})}),s.sort(function(e,s){var a=e.score,r=s.score;return a-r}),s.forEach(function(e,s){var a=$("#score-template").html();a=a.replace("{{RANK}}",s+1+"").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SCORE}}",e.score),a=$(a),$("#scores").append(a)})}var QUESTION_ID=58319,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],answer_ids,answers_hash,answer_page=1;getAnswers();var VALID_HEAD=/<h\d>([^\n,]*)[, ]*(\d+).*<\/h\d>/;
body{text-align:left!important}table thead{font-weight:700}table td{padding:10px 0 0 30px}#scores-cont{padding:10px;width:600px}#scores tr td:first-of-type{padding-left:0}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Scores

	User	Language	Score

{{RANK}}	{{NAME}}	{{LANGUAGE}}	{{SCORE}}

I have two comments on the use of the sandbox: 1. If you're going to use the sandbox, use the sandbox. There is no point posting something there for 4 hours. 24 hours is the minimum which makes sense. 2. Once you post a question which has been sandboxed, you should replace the body of the sandbox post with a link to the live question. This reduces clutter and avoids confusion.

Why must the inputs be given in that order?

Simplicity between answers. @BetaDecay

CJam, 31 28 29 bytes
Latest version rounds up time to next integer. I had missed that in the requirements. This adds 2 bytes, and saves 1 byte based on a suggestion by Dennis.
l~_3$W#2$mLm]@1$#(@(/@/@*m]S\

Try it online
Thanks to @ThomasKwa for suggesting the use of mL instead of the quotient of two separate logarithms.
This uses basic log laws for calculating the number of bounces, and then the sum of a geometric series, which I had to look up on Wikipedia.
Explanation:
l~    Get and interpret input.
_     Copy B, will need this later.
3$    Get copy of H to top.
W#    Calculate H^-1 = 1/H as double.
2$    Get copy of B to top.
mL    Log with base.
m]    Ceiling. This is the number of bounces N.
@     Rotate one copy of B to top.
1$    Copy number of bounces to top.
#     Exponent B^N.
(     Subtract 1.
@     Get other copy of B to top.
(     Subtract 1.
/     Divide the two values.
@/    Rotate V to top and divide.
@*    Get H to top and multiply. This is T.
m]    Ceiling for time.
S\    Swap a space between the two resulting values.

@ThomasKwa I hadn't seen that the time needs to be rounded. It was shown as floating point in the example calculation, but it's indeed rounded to int at the very end. Weird, but I'll add it. CJam does not have a unary minus, so changing the sign is 2 bytes. I was considering that, but it didn't look like it was going to be shorter.

Python2, 84 82 bytes
from math import*
h,v,b=input()
n=ceil(-log(h,b))
print ceil(h*(b**n-1)/(b-1)/v),n

Closed forms, yay!

log(h,1./b) -> -log(h,b)?

@ThomasKwa Of course :)

TI-BASIC, 35
Prompt H,V,B
-int(logBASE(H,B
Disp -int(H/V(B^Ans-1)/(1-B
Ans

A port of orlp's Python answer.

CoffeeScript, 62 bytes
f=(h,v,b,n=t=0)->(t+=h/v;h*=b;n++)while 1<=h;n+' '+Math.ceil t

Pyth, 27 bytes
L_/b1y_c*Qt^KvwJy.lQK*vwtKJ

Direct port of my Python answer. Takes input in the following format:
h
b
v

When I input 10 10 0.5 I get a syntax error, and 10\n10\n0.5 gives me -2 -1.

@ThomasKwa As said in my answer, the correct format would be 10\n0.5\n10.

OP says the inputs must be passed in the order h v b (which I don't agree with, btw).

@ThomasKwa Ugh... I can't be arsed to fix this. Too bad.

PHP, 87 bytes
Takes three command line arguments.
<?for($h=$argv[1],$n=$t=0;$h=>1;$n++){$t+=$h/$argv[2];$h*=$argv[3];}echo"$n ".ceil($t);


text:
Compute the Digit Difference Sum of a Number
Consider taking some non-negative integer such as 8675309 and computing the absolute values of the differences between all the pairs of neighboring digits.
For \$8675309\$ we get \$|8-6| = 2\$, \$|6-7| = 1\$, \$|7-5| = 2\$, \$|5-3| = 2\$, \$|3-0| = 3\$, \$|0-9| = 9\$. Stringing these results together yields another, smaller non-negative integer: \$212239\$. Repeating the process gives \$11016\$, then \$0115\$, which by the convention that leading zeros are not written simplifies as \$115\$, which becomes \$04\$ or \$4\$, which can't be reduced any further. Summing all these values up we get \$8675309 + 212239 + 11016 + 115 + 4 = 8898683\$.
Let's define the Digit Difference Sum (or DDS) as this operation of repeatedly taking the digit differences of a number to form a new number, then adding all the resulting numbers to the original.
Here are the first 20 values in the corresponding DDS sequence:
N   DDS(N)
0   0
1   1
2   2
3   3
4   4
5   5
6   6
7   7
8   8
9   9
10  11
11  11
12  13
13  15
14  17
15  19
16  21
17  23
18  25
19  27

Here are the first 10000 values, the graph for which is quite curious:

Especially since it looks the same when you plot it to 1000 or even 100:

(I'd call it the dentist's staircase...)
Challenge
Write a program or function that takes in a non-negative integer and prints or returns its DDS value. For example, if the input was 8675309, the output should be 8898683.
The shortest code in bytes wins.

dentist's staircase?

@MartijnR Dentist's staircase.

@Calvin'sHobbies Orthodontist's staircase?

@BetaDecay Dentist's staircase.

Pyth, 17
s.ui.aM-VJjNTtJTQ

Try it here or run the Test Suite
Explanation:
s.u            Q   # Cumulative reduce, i.e. getting the intermediate values of each reduce
                     step and returning them as a list, then sum the list
   i ... T         # Convert the resulting list of numbers into a base 10 number
   .aM             # Get the absolute value of each element of ...
      -VJjNTtJ     # Perform vector subtraction on the lists given by
        JjNT       # assign J the number we currently have converted to its base 10 digits
            tJ     # and J[1:]. e.x. for 123 we get J = [1,2,3] then we do
                   # zip(J,J[1:]) which gives [[1,2],[2,3]] then element wise subtract
                   # to get [-1, -1]

What language is this? So cryptic! T_T

@asgs Welcome to PPCG :) It's called Pyth, you can find an interpreter and some documentation at its Github page. Most of the users of this language are active on this site, so if you have questions about it feel free to ask in chat or the room dedicated to it :)

Python 2, 73
Luckily, I managed to avoid any string operations.
t=lambda n:n>9and abs(n%10-n/10%10)+10*t(n/10)
g=lambda n:n and n+g(t(n))

g is the function that computes the answer.

What is this black magic?!

@BetaDecay I believe it's called "math".

I don't know Python quite well enough to tell, but can you apply the remainder operation to both terms in one hit? That is, would (n-n/10)%10 operate the same as n%10-n/10%10? Or maybe even (9*n/10)%10?

@GlenO In Python, % is a true modulus operator, not a remainder, so that wouldn't work.

Matlab, 101 105 bytes
Thanks a lot to @beaker for his suggestion to use polyval instead if base2dec. That allowed me to

save 4 bytes;
greatly simplify the generalization to arbitrary base (see below) and save 22 bytes there; and most of all,
helped me realize that the code for the general case was wrong (leading zeros were not being removed). The code and the graphs are correct now.

Code:
function y=f(y)
x=+num2str(y);while numel(x)>1
x=polyval(abs(diff(x)),10);y=y+x;x=+dec2base(x,10);end

Example:
>> f(8675309)
ans =
     8898683

Bonus: arbitrary base
A small generalization allows one to use an arbitrary number base, not necessarily decimal:

Arbitrary base from 2 to 10, 108 104 bytes
function y=f(y,b)
x=+dec2base(y,b);while numel(x)>1
x=polyval(abs(diff(x)),b);y=y+x;x=+dec2base(x,b);end

The reason why this works only for base up to 10 is that Matlab's dec2base function uses digits 0, 1, ..., 9, A, B, ..., and there's a jump in character (ASCII) codes from 9 to A.
Arbitrary base from 2 to 36, 124 146 bytes
The jump from 9 to A referred to above needs special treatment. The maximum base is 36 as per Matlab's dec2base function.
function y=f(y,b)
x=+dec2base(y,b);x(x>57)=x(x>57)-7;while numel(x)>1
x=abs(diff(x));x=x(find(x,1):end);y=y+polyval(x,b);end

This is how the dentist's staircases look for different bases:

This is what I would have done... time to think of another answer lol. +1.

@rayryeng :-) Thanks

@BetaDecay Thanks! :-) They're pretty indeed

CJam, 22 21 bytes
ri_{\s2ew::-:zsi_@+}h

Note that this program exits with an error, which is allowed by default.
With the Java interpreter, errors can be suppressed by closing STDERR. If you try this code online in the CJam interpreter, ignore all output before the last line.
Thanks to @Sp3000 for pointing out an error in the original revision.
Thanks to @MartinBüttner for golfing off 1 byte.
Example run
$ cjam digit-difference.cjam 2>&- <<< 8675309
8898683

How it works
ri_   e# Read an integer (I) from STDIN and push a copy (A).
{     e# Do:
  \   e#   Swap I on top of A.
  s   e#   Cast I to string.
      e#   For example, 123 -> "123".
  2ew e#   Push the overlapping slices of length 2 (pair of adjacent digits).
  ::- e#   Replace each pair by its difference.
  :z  e#   Apply absolute value to each difference.
  si  e#   Cast to string, then to integer. This is the new I.
      e#   For example, [1 2 3] -> "123" -> 123.
  _   e#   Push a copy of I.
  @   e#   Rotate A on top of the copy of I.
  +   e#   Add I to A, updating A.
}h    e# While A is truthy, repeat the loop.

A will always be truthy when checked by h. However, once I is a single-digit integer, 2ew will fail with an error after consuming the array it was called on. This leaves only the desired result on the stack, which is printed before exiting.

Posted in 7 minutes flat :O

Labyrinth, 176 134 127 119 103 97 88 82 79 76 72 bytes
Thanks to Sp3000 for saving 1 byte and paving the way for 2 more.
This could probably still be shortened, but hey, it beats Java Matlab Python...
?
_
)/:}+{:`};!
9       "
_ :}-"" :_10
;;{: `" "  :
  {  (_:/=%}
  0+;`"

Try it online.
This terminates with an error but the error message is written to STDERR (which is why you don't see it in TIO).
The implementation is fairly straight-forward. We add the current value to a running total. If the current value was greater than 9, we compute its base-10 digits (via repeated div-mod), and form a new number from the absolute differences. If we get to 9 or less, we print the running total.
The digits of the current number are collected on the auxiliary stack with the most significant digit on top.
Well, the fancy implementation of abs(...) I had here turned out to be ridiculously complicated compared to the new solution... I'll add an updated explanation when I'm done golfing this further.

Julia 0.4, 81 60 bytes
n->(s=n;while n>9 s+=n=int(join(abs(diff(["$n"...]))))end;s)

Ungolfed:
function f(n::Int)
    # Initialize a sum to the input
    s = n

    while n > 9
        # Get absolute values of the pairwise differences of the
        # digits of n, join as a string, convert it to an integer,
        # and reassign n
        n = int(join(abs(diff(["$n"...]))))

        # ["$n"...] actually splits n as a string into a vector
        # of its characters, but the difference between ASCII
        # codes is the same as the difference between the numbers
        # so it works as expected

        # Add the new n to the running sum
        s += n
    end

    # Return the sum
    return s
end

Try it online!
Saved 21 bytes thanks to feersum and Glen O!

Is there any reason ndigits(n)>1 is different than n>9 ?

Suggestion: int(join(abs(diff(["$n"...])))) saves 9 bytes. Switch to n>9 as suggested by feersum for another 9 bytes saved. Save three more bytes by performing both assignments in the while loop in one step (and removing the extra, now unnecessary semicolon): n->(s=n;while n>9 s+=n=int(join(abs(diff(["$n"...]))))end;s)

@feersum Um, nope. Thanks!

@GlenO Awesome, thanks!

Java - 300 bytes
Golfed Version
static Long t=new Scanner(System.in).nextLong();static char[]c=t.toString().toCharArray();public static void main(String[]z){while(c.length>1)s();System.out.print(t);}static void s(){String s="";for(int i=0;i<c.length-1;)s+=Math.abs(c[i]-c[++i]);Long a=new Long(s);t+=a;c=a.toString().toCharArray();}

Ungolfed / Full version
import java.util.Scanner;

public class DigitDifference {

    static Long t = new Scanner(System.in).nextLong();
    static char[] c = t.toString().toCharArray();

    public static void main(String[] args){
        while( c.length > 1 )
            s();
        System.out.print(t);
    }

    static void s(){
        String s="";
        for(int i = 0; i < c.length-1;)
            s += Math.abs(c[i]-c[++i]);
        Long a = new Long(s);
        t += a;
        c = a.toString().toCharArray();
    }
}

@Loovjo, Cheers..

Welcome to PPCG! This can still be golfed a lot. I haven't looked at the logic much but: 1) Pull all of this into one function since you don't really need a separate one (or a full program/class for that matter) 2) Get rid of the statics after pulling them in 3) (a+"") is generally the same as a.toString(), but shorter 4) You don't need a Scanner if it's just a function, simply take a long as input.

For example, without changing much of the working, and just removing cruft, it's around 164: long f(long t){long a=t;char[]c;while((c=(a+"").toCharArray()).length>1){String s="";for(int i=0;i<c.length-1;)s+=Math.abs(c[i]-c[++i]);t+=a=new Long(s);}return t;}

@Geobits, that was amazing buddy. I'm new to Code Golf, so I'll try to improve my codign efficiency. Cherrs..

oK, 37 32 24 23 bytes
+/(10/{%x*x}1_-':.:'$)\

In action:
  +/(10/{%x*x}1_-':.:'$)\8675309
8898683

  (+/(10/{%x*x}1_-':.:'$)\)'!20
0 1 2 3 4 5 6 7 8 9 11 11 13 15 17 19 21 23 25 27

K5 has a few features which are well suited to this- "encode" and "decode" can perform base conversion, each-pair (':) pairs up sequential elements in a list and fixed point scan (\) can produce the iterated sequence until it stops changing. The lack of a primitive abs() leads to some unsightly bulk in the form of {(x;-x)x<0}', though.
Edit:
Instead of {(x;-x)x<0}', I can (somewhat wastefully) take the square root of the square of the sequence ({%x*x}, saving 5 bytes.
Edit 2:
Inspired by @maurinus' APL solution, I can replace the "decode" (((#$x)#10)\x) with evaluating each character of the string representation of the number- .:'$x! This also lets me use a tacit form of the whole expression, saving additional characters.

Python 2, 87 bytes
f=lambda n:n and n+f(int('0'+''.join(`abs(int(a)-int(b))`for a,b in zip(`n`,`n`[1:]))))

Recursively adds the current number and takes the digits differences. Lots of converting between numbers and strings. Probably can be improved.

Mathematica, 72 69 65 bytes
Tr@FixedPointList[FromDigits@*Abs@*Differences@*IntegerDigits,#]&

I'm open to suggestions here.

Tr@FixedPointList[FromDigits@*Abs@*Differences@*IntegerDigits,#]&

@alephalpha Interesting concept, creating extra zeroes...

Julia, 55 48 bytes
h=n->(n>9&&h(int(join(abs(diff(["$n"...]))))))+n

Ungolfed:
function h(n)
  if n>9
    # If multiple digits, find the digit difference...
    digitdiff=int(join(abs(diff(["$n"...]))))
    # ... recurse the function...
    downsum=h(digitdiff)
    # ... and return the sum so far (working up from the bottom)
    return downsum+n
  else
    # If single digit, no further recursion, return the current number
    return n
  end
end

Essentially, this recurses down to the single-digit level (where no digit difference can be performed), then sums back up as it exits the recursion, level by level.

APL (22)
{⍵≤9:⍵⋄⍵+∇10⊥|2-/⍎¨⍕⍵}

Explanation:

⍵≤9:⍵: if ⍵ ≤ 9, return ⍵ unchanged.
⍎¨⍕⍵: convert ⍵ to a string, then evaluate each character
2-/: subtract every two adjacent numbers
|: take the absolute values
10⊥: turn the array into a base-10 number
⍵+∇: call the function recursively with this new value, and add the result to the input

Haskell, 140 bytes
d does the job.
import Data.Char
d n=sum.m(read.m intToDigit).fst.span(/=[]).iterate s.m digitToInt.show$n
s l@(h:t)=snd$span(==0)$m abs$zipWith(-)l t
m=map

Does anyone know how to avoid importing the long conversion functions?

intToDigit is toEnum.(+48) and digitToInt is (\i->fromEnum i-48). You can also turn s to a pointfree version with  =<< in list context: s=snd.span(==0).m abs.(zipWith(-)=<<tail). Finally, (==0) is (<1), because we're working with non-negative integers.

... oh, and if s is pointfree, there's not need to give it a name. Call it directly: iterate(snd.span ... tail))

... it's me again to correct a mistake in my first comment: =<< is used in function context, not list context, sorry.

Brilliant! Also, is it common procedure here to use GHC extensions? NoMonomorphismRestriction will let me have d pointfree, too.

Isn't chr.(+48) even shorter than toEnum.(+48), and (\i->ord i-48) than (\i->fromEnum i-48)?

chr and ord are both in Data.Char, so you can't omit the import. Compiler flags are counted as bytes, too, so NoMonomorphismRestriction increases your score by 25.

disappointing, but good to know!

K5, 50 bytes
+/{(r;x)@~r:.,/"0",{$(0;-r;r)@(~^r)+0<r:x-y}':$x}\

Python 3, 125 bytes
I used to like the shortness of regex until I tried to use it for this challenge...re.findall('\d\d',s,overlapped=True) is not on ;)
s=input()
p=int
x=p(s)
while p(s)>9:g=str(s);s=p(''.join(str(abs(p(g[i])-p(g[i+1])))for i in range(len(g)-1)));x+=s
print(x)

Cheers @Todd :)

You can perform inplace addition on an integer rather than a list which will remove the need to square brackets and the final sum.
's=p(input())'
will allow you the remove the int conversion on the while loop and assignment to x.
Also consider looping through the zip of g and g[1:] which should save some bytes.

JavaScript ES6, 73 bytes
t=n=>(b=10,M=Math).ceil(n&&n+t((j=n=>n>9&&M.abs(n%b-n/b%b)+b*j(n/b))(n)))

This isn't getting any shorter :/ I'll try more approaches but this is the shortest one so far

If you just leave it as an anonymous function instead of assigning it to t it's still valid and saves you 2 bytes.

@PatrickRoberts yes but I'm using recursion so I need to name it

Oh, missed that, fair enough.

JavaScript (ES6), 69
Test running the snippet below in an EcmaScript 6 compliant browser (but not Chrome as it still does not support the spread operator ...) MS Edge maybe?

f=n=>n&&(n+=r='',[...n].map(d=>(r+=d>p?d-p:p-d,p=d),p=n[0]),+n+f(+r))

function test()
{
  var i=+I.value
  O.innerHTML = i+' -> '+f(i) + '\n' + O.innerHTML
}
<input id=I value=8675309><button onclick=test()>-></button>

Alternative, using array comprehension that is now targeted EcmaScript 2016 (ES7), 67 bytes:

f=n=>n&&(n+=r='',p=n[0],[for(d of n)(r+=d>p?d-p:p-d,p=d)],+n+f(+r))

Vyxal, 12 7 bytes
≬¯ṅ⌊İ∑+

Try it Online!
-5 bytes thanks to allxy
How?
≬¯ṅ⌊İ∑+ # full program
≬¯ṅ⌊    # Three element lambda
 ¯      # Deltas (consecutive differences of digits)
  ṅ     # Join by nothing
   ⌊    # Convert to integer
    İ   # Apply this lambda on the (implicit) input and collect unique values
     ∑  # Summate
      + # Add to (implicit) input

7. I find it very interesting that ⌊ parses it the way it does.

Perl 5 -p, 49 bytes
$\+=$_;s/.(?=(.))/abs$&-$1/ge;s/^0+|.$//g&&redo}{

Try it online!

J, 70 bytes
 +/([:10&#.[:(2|@:-/\])[:10&(]#:~[#~[:>.[^.])])`]@.(11&>)^:a:".(1!:1)3

MATLAB (141)(137)

EDIT: 4 bytes less, thanks to @Andras

function[s j]=n(T,b,c),if(T/b>9),u=fix(T/10);[x e]=n(T,b*10,0);y=n(u,b,0);[w z]=n(u,b,c);s=abs(x-y);j=s+e+10*c*z;else,s=mod(T,10);j=s;end

This doest beat @LuisMendo 's answer but atleast I could reduce execution time, which by, I would have just tried to diversify ways of tackling this problem.
I could reduce it more but as I go for less time, i waste more bytes, so here is the principle:

The program is summing up digits of same row before inlined digits , it does mean it used integer division "n/10" log_10(n) times only, complexity is O(N).
If n= a b c d
a          b           c           d
   |a-b|       |b-c|       |c-d|
    ||a-b|-|b-c|| ||b-c|-|c-d||
   ....

My program calculates:
a+|a-b| + | |a-b|-|b-c| |  +  |  | |a-b|-|b-c| | - | |b-c|-|c-d| |  |
+10*(
b+|b-c| + | |b-c|-|c-d| |
+10*(
c+|c-d|
+10*(
d
)
)
)

Usage:
  [a b]=n(13652,1,1)

a =
1
 b =

   16098

You can spare 4 bytes by omitting the optional ,end of the function declaration.

Please consider revising the grammar of your post.  I can't quite understand what you have said.

Prolog, 143 bytes
Code:
q(X,N):-X<9,N=0;A is abs(X mod 10-X//10 mod 10),Y is X//10,q(Y,M),N is A+M*10.
r(X,N):-X<9,N=X;q(X,Y),r(Y,M),N is X+M.
p(X):-r(X,N),write(N).

Explained:
q(X,N):-X<9,N=0;                                                         % If only one digit, the difference is 0
        A is abs(X mod 10-X//10 mod 10),Y is X//10,q(Y,M),N is A+M*10.   % Else, the difference is the difference between the last 2 digits + the recursive difference of the number without the last digit
r(X,N):-X<9,N=X;                                                         % If we only have 1 digit the final answer is that digit
        q(X,Y),r(Y,M),N is X+M.                                          % Else, the final answer is the current number + the recursive difference of that number
p(X):-r(X,N),write(N).

q does the calculations that convert a number into it's Digit Difference.
r recursively calls q and sums up the results to find the Digit Difference Sum.

p is the entry point. Takes a number, calls r and prints the answer.

Example:
>p(8675309).
8898683

Try it online here.

PHP - 198 bytes
<?$x=$t=$_GET['V'];function z($x){global$t;for($i=0;$i<strlen($x)-1;$i++){$z=str_split($x);$r.=str_replace('-','',$z[$i]-$z[$i+1]);}$r=ltrim($r,'0');$t+=$r;return strlen($r)>1?z($r):0;}z($x);echo$t;

Ungolfed
<?
$x=$t=$_GET['V']; // Gets the value from input
function z($x){
    global$t;
    for($i=0;$i<strlen($x)-1;$i++){
        $z=str_split($x); //Turns the string into an array
        $r.=str_replace('-','',$z[$i]-$z[$i+1]); // Sums the two values and removes the minus signal
    }
    $r=ltrim($r,'0'); // Remove trailing zeroes
    $t+=$r; // Adds to global var
    return strlen($r)>1?z($r):0; // Checks the size of the string. If >1, calls the function again
}

z($x);
echo$t;

Perl 6, 56 bytes
{[+] $_,{+.comb.rotor(2=>-1)».map((*-*).abs).join}…0} # 56 bytes

usage:
my &code = {...} # insert code from above

(180..190).map: &code;
# (259 258 259 260 261 262 263 264 265 266 280)

say code 8675309; # 8898683

Jelly, 6 bytes
ạƝḌ$ƬS

Try it online!
How it works
ạƝḌ$ƬS - Main link. Takes an integer n on the left
   $Ƭ  - Repeat the following until a repeated value, collected intermediate results:
 Ɲ     -   Convert an integer to digits, and on overlapping pairs:
ạ      -     Take the absolute difference
  Ḍ    -   Convert from digits to an integer
     S - Take the sum of these values

Husk, 8 bytes
ΣU¡ȯdẊ≠d

Try it online!

Japt -x, 9 8 bytes
Èìä'a}hN

Try it

Factor + math.extras project-euler.common, 83 81 bytes
[ 0 swap [ [ + ] keep number>digits differences vabs digits>number ] until-zero ]

Attempt This Online!

0 swap Initialize the sum.
[ ... ] until-zero Call a quotation until its result is 0, dropping the 0 from the stack.
[ + ] keep Add the current summand to our sum.
number>digits differences vabs digits>number Get the next summand.

C 162 bytes
golfed:
main(int argc,char **argv){char *c=argv[1];int u=atoi(c),d;do{while(c[1]!=0){*c=abs(*c-*(c+1))+48;c++;}*c=0;c=argv[1];d=atoi(c);u+=d;}while(d>9);printf("%d",u);}

ungolfed:
main(int argc, char **argv)
{
    char *c=argv[1];
    int u=atoi(c),d;

    do
    {
        while(c[1]!=0)
        {
            *c=abs(*c-*(c+1))+48;
            c++;
        }

        *c=0;
        c=argv[1];
        d=atoi(c);
        u+=d;
    }
    while(d>9);

    printf("%d\n",u);
}

R, 134 Bytes
Code
f=function(x){z=x;while(z>9){n=seq(nchar(z));z=abs(diff(strtoi(substring(z,n,n))));z=sum(z*10**(rev(seq(length(z)))-1));x=x+z};cat(k)}

Test it online.
Ungolfed
f=function(x){
  z=x;
  while(z>9){
    n=seq(nchar(z));
    z=abs(diff(strtoi(substring(z,n,n))));
    z=sum(z*10**(rev(seq(length(z)))-1));
    x=x+z
  };
  cat(x)
}

Here is the plot of the difference of the "Digit Difference Sum of a Number" series from f(1) to f(1m). Just because I love to diff.

Plot code
s <- seq(1,100000)
serie <- sapply(s,f)
plot(diff(ts(serie)),xlab="",ylab="")

05AB1E, 10 9 bytes
λ£üαJï}þO

Try it online or verify the first 1001 test cases.
Explanation:
Unfortunately the Cumulative fixed-point builtin .Γ (to reduce until the result no longer changes and collecting all intermediate results) won't include the starting value. In addition, we'll have to remove the trailing empty string value. So it would be 10 bytes: .ΓüαJï}¨O+ - try it online.
So using this unorthodox method with the recursive environment saves a byte in the end:
λ      # Start a recursive environment,
 £     # to calculate the values in the range [a(0),a(implicit input)]
       # Starting with a(0) = (implicit) input
       # Where every following a(n) is calculated as:
       #  (implicitly push a(n-1))
  ü    #  For each overlapping digit:
   α   #   Get the absolute difference
    J  #  Join these differences together to a string
     ï #  Remove potential leading 0s (by casting to an integer)
}      # After the recursive environment
 þ     # Remove all empty trailing strings by only keeping numbers
  O    # Sum those numbers together
       # (which is output implicitly as result)

Julia 1.4, 47 bytes
!n=n+(n>9&&!evalpoly(10,abs.(diff(digits(n)))))
Attempt This Online!

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