text:
Shortest program to split a string at non-digits without RegExps
EDIT: If you're using Lisp, I have given some guidelines at the bottom in counting bytes.
Objective: Make the shortest function that splits a string at non-digits and returns an array consisting of only digits in each string, without the use of any regular expressions. Leading zeroes are to be included in each string.
Current Standings (separated in categories):

C/C++/C#/Java: 68 (C) ....
GolfScript/APL/J: 13 (APL)
All others: 17 (Bash, uses tr), 24 (Ruby)

Rules:

The format must be as a function with a single string argument. Up to two additional arguments may be added if necessary for the proper return of the array (e.g. sh/csh/DOS Batch needs an extra variable reference to return, etc.).

The primary function declaration doesn't count, and nor does importing other standard libraries. #includes, imports, and usings don't count. Everything else does. This does include #defines and helper functions. Sorry for the confusion. Refer to this as a helpful guide as to what does/does not count (written in C-style syntax)
// doesn't count toward total, may be omitted unless
// non-obvious, like half of Java's standard library.
#include <stdio.h>

import some.builtin.Class // doesn't count, see above

#define printf p // counts towards total

/* Any other preprocessor directives, etc. count. */

int i = 0; // counts

someFunction(); // counts

char[][] myMainSplitFunction(char[][] array) { // doesn't count
  // Everything in here counts
  return returnArray; // Even this counts.
} // doesn't count

/* Everything in here counts, including the declaration */
char[][] someHelperFunction(char[] string) {
    // stuff
} // even this counts

The output must be a string array or similar (Array lists in Java and similar are acceptable). Examples of accepted output: String[], char[][], Array<String>, List<String>, and Array (object).

The array must contain only contain variable-length string primitives or string objects. No empty strings should be present in the return, with the exception below. Note: the strings are to contain a string of consecutive matches, such as the example input and output below.

If there are no matches, then the function body should return null, an empty array/list,  or an array/list containing an empty string.

No external libraries allowed.

DOS line endings count as one byte, not two (already covered in meta, but needs to be emphasized)

And the biggest rule here: no regular expressions allowed.

This is a code-golf question, so shortest code wins. Good luck!
And here are some example inputs and outputs (with C-style escapes):

Input:  "abc123def456"
Output: ["123", "456"]

Input:  "aitew034snk582:3c"
Output: ["034", "582", "3"]

Input:  "as5493tax54\\430-52@g9.fc"
Output: ["5493", "54", "430", "52", "9"]

Input:  "sasprs]tore\"re\\forz"
Output: null, [], [""], or similar

Please put how many bytes used by your answers, and as always, happy golfing!

Guidelines for Lisp
Here's what does and doesn't count in Lisp dialects:

;;; Option 1
(defun extract-strings (a b) ; Doesn't count
(stuff) ;;; Everything in here counts
) ; Doesn't count
;;; Option 2
(defun extract-strings (string &aux (start 0) (end 0)) ; Doesn't count
(stuff) ;;; Everything in here counts
) ; Doesn't count.

All other lambdas fully count towards the byte count.

Wasn't this asked before?

Yes, but I re-asked it on Meta and made substantial edits to it before posting it again here. Because of this, it shouldn't be classified as a duplicate (the other related one should be closed if not already).

@IsmaelMiguel It's been deleted.

Shouldn't your "golf" be posted as an answer?

Sorry, but -1 for disallowing GolfScript. All languages should be allowed.

@Doorknob That's true, but I also understand the OP's feelings. People should have a chance to compete even if they don't speak GolfScript, J, or APL (and I'm guilty of perusing the latter in these competitions.) Can you give a look at my proposal in the thread he linked to?

I did edit the rules a little because I missed the other two (J i intentionally overlooked, but I forgot about APL). I am going to have two separate scoring levels for those three and any others.

Comment added by request of @maf-soft: the c# 66 solution was invalid: it returns all digits as char-array

APL, 13 chars
(or 28 / 30 bytes, read below)
{⍵⊂⍨⍵∊∊⍕¨⍳10}

I see you've banned GolfScript from your question. I understand your sentiment, but I hope this community won't eventually ban APL, because it's a truly remarkable programming language with a long history, not to mention a lot of fun to code in. Maybe it could just be scored differently, if people feel it's competing unfairly. I'll post my thoughts on this matter to that thread you've linked.
On that same token, I've always added a footnote to my APL posts, claiming that APL could be scored as 1 char = 1 byte. My claim rests on the fact that a few (mostly commercial) APL implementations still support their own legacy single-byte encoding, with the APL symbols mapped to the upper 128 byte values. But maybe this is too much of a stretch, in which case you may want to score this entry as 28 bytes in UTF-16 or 30 bytes in UTF-8.
Explanation
{        ⍳10}  make an array of naturals from 1 to 10
       ⍕¨      convert each number into a string
      ∊        concatenate the strings into one (it doesn't matter that there are two 1s)
    ⍵∊         test which chars from the argument are contained in the digit string
 ⍵⊂⍨           use it to perform a partitioned enclose, which splits the string as needed

Examples
      {⍵⊂⍨⍵∊∊⍕¨⍳10} 'ab5c0x'
 5  0
      {⍵⊂⍨⍵∊∊⍕¨⍳10}  'z526ks4f.;8]\p'
 526  4  8

The default output format for an array of strings does not make it clear how many strings are there in the array, nor how many blanks. But a quick manipulation to add quotes should make it clear enough:
      {q,⍵,q←'"'}¨ {⍵⊂⍨⍵∊∊⍕¨⍳10} 'ab5c0x'
 "5"  "0"
      {q,⍵,q←'"'}¨ {⍵⊂⍨⍵∊∊⍕¨⍳10}  'z526ks4f.;8]\p'
 "526"  "4"  "8"

Regarding your comment, I think that for other languages compete fairly with "shorthand" ones one should count each symbol in the other languages as one char. For example, my Mathematica solution posted here should be counted as 7 (more or less). Designing a language with compressed tokens is not merit at all, I think.

Could you provide a hex dump of your golf? I can't read some of the characters.

@impinball How would the hexdump help you? It's not like you would see what is being done.

@impinball the APL code is {omega enclose commute omega epsilon epsilon format each iota 10}. If you need the unicode values you can just copy and paste it to any online tool, even if you can't see the characters (which is strange, as most modern Unicode fonts have the APL symbols) In any case what you get is this {\u2375\u2282\u2368\u2375\u220a\u220a\u2355\u00a8\u237310} (mind the last "10" which is not part of the escape sequence)

For some reason, it was not rendering on my Andriod with both Dolphin and Chrome, and on IE on this computer, the majority aren't rendering, either. But thank you, anyways.

I am changing the rules a bit to actually score them separately.

One of the less ⍨-ish APL solutions!

Before seeing your program I couldn't fully appreciate Dijkstra's quote about "APL [being] a mistake, carried through to perfection." (link). Thank you for an eye-opener ;-)

@dasblinkenlight You're welcome. I of course disagree with the mistake part. If you wish to peruse my posting history on this site, you'll find many APL posts, almost always followed by an explanation of the algorithm. The most recent golf I won was with 4 chars, for an admittedly non-trivial question :-)

@Tobia OMG! After seeing your four-character winner I no longer sure that APL was a mistake - I am beginning to sense a malicious intent :) :) :)

@dasblinkenlight Yes, world domination. We're working on it. APL has been one of the preferred languages in the financial sector for many decades. DUM DUM DUM…

Instead of ∊⍕¨⍳10, couldn't you just use ⎕D? That should be the constant '0123456789'. Dyalog APL at the very least supports it, and so does NARS2000.

@marinus Yes I could. I didn't know it when I wrote this entry, thank you.

You should mention that this is only APL2 (or proper ⎕ML for APL*PLUS/Dyalog APL), and so it doesn't work on TryAPL.org.

Python 47
Implementation
f=lambda s:"".join([' ',e][e.isdigit()]for e in s).split()

Demo
>>> sample=["abc123def456","aitew034snk582:3c","as5493tax54\\430-52@g9.fc","sasprs]tore\"re\\forz"]
>>> [f(data) for data in sample]
[['123', '456'], ['034', '582', '3'], ['5493', '54', '430', '52', '9'], []]

Algorithm
Convert each non-digit character to space and then split the resultant string. A simple and clear approach.
And a fun solution with itertools (71 characters)
f1=lambda s:[''.join(v)for k,v in __import__("itertools").groupby(s,key=str.isdigit)][::2]

Ruby, 70
f=->(s){s.chars.chunk{|c|c.to_i.to_s==c}.select{|e|e[0]}.transpose[1]}

Online Version for testing
Since converting any non-digit character to an int returns 0 in Ruby (with to_i), converting every char to int and back to char is the non-regex way to check for a digit...

You can also do a ('0'..'9').member? for every char, but what you did is shorter already

You are definitely right - I should have said: "a" way ;)

Bash, 21 bytes 17/21 bytes (improved by DigitalTrauma)
Building a space-separated list with tr
function split() {
tr -c 0-9 \ <<E
$1
E
}

replaces any non digit by a space
Usage
$ for N in $(split 'abc123def456'); do echo $N; done
123
456

Edit
as pointed by the comments below, the code can be stripped down to 17 bytes:
function split() (tr -c 0-9 \ <<<$1)

and as the result is not stricly speaking a Bash array, the usage should be
a=(`split "abc123def456"`); echo ${a[@]}

and the extra (``) should be counted

Gah you beat me to it!  But why not use a here-string instead of a here-document?  Also you can save a newline at the end of the function content you use (blah) instead of {blah;}:   split()(tr -c 0-9 \ <<<$1).  That way your function body is only 17 chars.

Your function returns a "space-separated list" instead of an array.  Certainly returning true arrays from bash function is awkward, but you could at least assign the result of your function to an array in your usage:  a=($(split "12 3a bc123")); echo ${a[@]}.  It could be argued that "($())" be counted in your score

Before exploring the tr approach, I tried doing this with a parameter expansion.  tr is definitely the better approach for golfing purposes.

Have you tried surrounding the tr with the expansion operator? It would come out to something like ($(tr...)),  and where the function declaration doesn't count, the outer parentheses wouldn't count against you. It would only be the command substitution part.

I don't see how this should be working, but I'm not fluent in Bash arrays though. Anyway, the (``) construct is 1-char better than the ($()) one and shall be prefered.

bash, 26 (function contents: 22 + array assignment overhead 4)
This isn't going to beat the other bash answer, but its interesting because it might make you double-take:
f()(echo ${1//+([!0-9])/ })

Usage is:
$ a=(`f "ab5c0x"`); echo ${a[@]}
5 0
$ a=(`f "z526ks4f.;8]\p"`); echo ${a[@]}
526 4 8
$

At the first quick glance, //+([!0-9])/  looks a lot like a regexp substitution, but it isn't.  It is a bash parameter expansion, which follows pattern-matching rules, instead of regular expression rules.
Returning true bash array types from bash functions is a pain, so I chose to return a space-delimited list instead, then convert to an array in an array assignment outside of the function call.  So in the interests of fairness, I feel the (` `) around the function call should be included in my score.

 Mathematica 32
StringCases[#,DigitCharacter..]&

Usage
inps ={"abc123def456", "aitew034snk582:3c", "as5493tax54\\430-52@g9.fc",
        "sasprs]tore\"re\\forz"}
StringCases[#,DigitCharacter..]&/@inps

{{"123", "456"},
 {"034", "582", "3"},
 {"5493", "54", "430", "52", "9"},
 {}
}

The equivalent using regexes is much longer!:
StringCases[#, RegularExpression["[0-9]+"]] &

Mathematica sucks at regex.

Smalltalk (Smalltalk/X), 81
f := [:s|s asCollectionOfSubCollectionsSeparatedByAnyForWhich:[:ch|ch isDigit not]]

f value:'abc123def456'
-> OrderedCollection('123' '456')
f value:'aitew034snk582:3c'
-> OrderedCollection('034' '582' '3')
f value:'as5493tax54\430-52@g9.fc'
-> OrderedCollection('5493' '54' '430' '52' '9')
f value:'sasprs]tore\"re\forz'
-> OrderedCollection()
sigh - Smalltalk has a tendency to use veeeery long function names...

Is that a function name? o__O

@tobia Apparently...

asCollectionOfSubCollectionsSeparatedByAnyForWhich ಠ_ಠ This name is too long

C, 68 bytes (only the function's body)
void split (char *s, char **a) {
int c=1;for(;*s;s++)if(isdigit(*s))c?*a++=s:0,c=0;else*s=0,c=1;*a=0;
}

The first argument is the input string, the second one is the output array, which is a NULL-terminated string array. Sufficient memory must be reserved for a before calling the function (worst case: sizeof(char*)*((strlen(s)+1)/2)).
The input string is modified by the function (every non-digit character is replaced by '\0')
Usage example
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

void split (char *s, char **a) {
int c=1;for(;*s;s++)if(isdigit(*s))c?*a++=s:0,c=0;else*s=0,c=1;*a=0;
}

void dump(char **t) {
    printf("[ ");for(;*t;t++)printf("%s ", *t);printf("]\n");
}

int main() {
    char **r = malloc(1024);
    char test1[] = "abc123def456";
    char test2[] = "aitew034snk582:3c";
    char test3[] = "as5493tax54\\430-52@g9.fc";
    char test4[] = "sasprs]tore\"re\\forz";
    split(test1,r);
    dump(r);
    split(test2,r);
    dump(r);
    split(test3,r);
    dump(r);
    split(test4,r);
    dump(r);
    return 0;
}

Output
[ 123 456 ]
[ 034 582 3 ]
[ 5493 54 430 52 9 ]
[ ]

Un-golfed version:
void split (char *s, char **a) {
    int c=1; // boolean: the latest examined character is not a digit
    for(;*s;s++) {
        if(isdigit(*s)) {
            if(c) *a++ = s; // stores the address of the beginning of a digit sequence
            c=0;
        } else {
            *s=0; // NULL-terminate the digit sequence
            c=1;
        }
    }
    *a = 0; // NULL-terminate the result array
}

K (ngn/k), 27 bytes
{x@.t@=t-!#t:&~^(,/$!10)?x}

Try it online!

(,/$!10) generate "0123456789"
&~^(...)?x identify indices of digits in the input (e.g. "abc123def456" => 3 4 5 9 10 11)
.t@=t-!#t: split the indices into groups of adjacent indices (e.g. 3 4 5 9 10 11 => (3 4 5;9 10 11))
x@ index back into the original output and return (e.g. x[(3 4 5;9 10 11)] => ("123";"456"))

Perl, 53
Edit: on no matches, sub now returns list with empty string (instead of empty list) as required.
It also avoids splitting on single space character, as it triggers 'split on any white-space' behavior, which probably violates the rules. I could use / / delimiter, which would split on single space, but paradoxically it would look like using regexp pattern. I could use unpack at the cost of some extra characters and so get rid of split controversy altogether, but I think that, what I finish with, splitting on a literal character (other than space) is OK.
sub f{shift if(@_=split a,pop=~y/0-9/a/csr)[0]eq''and$#_;@_}

And, no, Perl's transliteration operator doesn't do regular expressions. I can unroll 0-9 range to 0123456789 if that's the problem.

As long as it doesn't use regular expressions, it's valid.

My Perl is not so strong. If I understand the code, you are replacing non-digits with a specific non-digit, then splitting on that chosen non-digit, then filtering out empty strings. Is this a correct reading?

@TimSeguine: Not exactly. Non-digits are replaced and squashed to a single character, splitting on which produces empty string if that delimiter happens to be at the beginning. It is then shifted away if list contains other entries.

Enpty list is okay.

VBScript, 190 (164 without function declaration)
Function f(i)
For x=1 To Len(i)
c=Mid(i,x,1)
If Not IsNumeric(c) Then
Mid(i,x,1)=" "
End If
Next
Do
l=Len(i)
i=Replace(i,"  "," ")
l=l-Len(i)
Loop Until l=0
f=Split(Trim(i)," ")
End Function

While not competitive at all, I'm surprised that VBScript comes out this short on this given how verbose it is (13 bytes for the CRs alone). It loops through the string, replacing any non-numeric characters with spaces, then reduces all the whitespace to single spaces, and then uses a space delimiter to divide it.
Test cases
Input: "ab5c0x"
Output: 5,0

Input: "z526ks4f.;8]\p"
Output: 526,4,8

DOS line endings count as one character as far as I've read on meta.

I suggested an edit for you.

The count already assumes Linux style 1 byte line endings. I get 190 characters by my count (just verified again).

Ok. I must have miscounted.

R, 81
f=function(x){
s=strsplit(x,"",T)[[1]]
i=s%in%0:9
split(s,c(0,cumsum(!!diff(i))))[c(i[1],!i[1])]
}

The function accepts a string and returns a list of strings.
Examples:
> f("abc123def456")
$`1`
[1] "1" "2" "3"

$`3`
[1] "4" "5" "6"

-
> f("aitew034snk582:3c")
$`1`
[1] "0" "3" "4"

$`3`
[1] "5" "8" "2"

$`5`
[1] "3"

-
> f("as5493tax54\\430-52@g9.fc")
$`1`
[1] "5" "4" "9" "3"

$`3`
[1] "5" "4"

$`5`
[1] "4" "3" "0"

$`7`
[1] "5" "2"

$`9`
[1] "9"

-
> f("sasprs]tore\"re\\forz")
$<NA>
NULL

Note: $x is the name of the list element.

Common Lisp (1 according to the letter;  ≈173 according to the spirit)
Here's a readable version.  The byte count is fairly high because of the long names in things like digit-char-p and position-if and vector-push-extend.
(defun extract-numeric-substrings (string &aux (start 0) (end 0) (result (make-array 0 :adjustable t :fill-pointer 0)))
  (loop
     (unless (and end (setq start (position-if #'digit-char-p string :start end)))
       (return result))
     (setq end (position-if (complement #'digit-char-p) string :start (1+ start)))
     (vector-push-extend (subseq string start end) result)))

(extract-numeric-substrings "abc123def456")
#("123" "456")

(extract-numeric-substrings "aitew034snk582:3c")
#("034" "582" "3")

(extract-numeric-substrings "as5493tax54\\430-52@g9.fc")
#("5493" "54" "430" "52" "9")

(extract-numeric-substrings "sasprs]tore\"re\\forz")
#()

The concept of "function declaration" is sort of vague.  Here's a version that only has one byte (the character x in the function body); everything else is bundled in to the auxiliary variables of the function's lamba list (part of the function's declaration):
(defun extract-numeric-substrings (string
                                   &aux (start 0) (end 0)
                                   (result (make-array 0 :adjustable t :fill-pointer 0))
                                   (x (loop
                                         (unless (and end (setq start (position-if #'digit-char-p string :start end)))
                                           (return result))
                                         (setq end (position-if (complement #'digit-char-p) string :start (1+ start)))
                                         (vector-push-extend (subseq string start end) result))))
  x)

The actual byte count will depend on how many of auxiliary declarations would have to be moved into the body for this to be deemed acceptable.  Some local function renaming would help, too (e.g., shorten position-if since it appears twice, use single letter variables, etc.).
This rendering of the program has 220 characters:
(LOOP(UNLESS(AND END(SETQ START(POSITION-IF #'DIGIT-CHAR-P STRING :START END)))(RETURN RESULT))(SETQ END(POSITION-IF(COMPLEMENT #'DIGIT-CHAR-P)STRING :START(1+ START)))(VECTOR-PUSH-EXTEND(SUBSEQ STRING START END)RESULT))

If nothing else, this should promote Common Lisp's &aux variables.
This can be written more concisely with loop, of course:
(defun extract-numeric-substrings (s &aux (b 0) (e 0) (r (make-array 0 :fill-pointer 0)))
  (loop
     with d = #'digit-char-p
     while (and e (setq b (position-if d s :start e)))
     finally (return r)
     do
       (setq e (position-if-not d s :start (1+ b)))
       (vector-push-extend (subseq s b e) r)))

The loop form, with extra space removed, has 173 characters:
(LOOP WITH D = #'DIGIT-CHAR-P WHILE(AND E(SETQ B(POSITION-IF D S :START E)))FINALLY(RETURN R)DO(SETQ E(POSITION-IF-NOT D S :START(1+ B)))(VECTOR-PUSH-EXTEND(SUBSEQ S B E)R))

I would count starting from (result on to the final parenthesis to be the body. The part that defines the name and parameters are the declaration.

Please refer to rule 2 on my amended rules to see what I'm really talking about in a function declaration (basically, declare function name, parameters, and if syntactically required, which is rare among interpreted languages, the return type).

@impinball Yeah, the "1" count is sort of a joke, but the important part here is that result is declared as a parameter here;  it just has a very non-trivial initialization form.  It's the same thing, in principle, as an optional argument with a default value that's computed by some complex expression.  (In simpler cases, it's easy to imagine something like char* substring( char *str, int begin, int end(0) ) in some language with a C-like syntax to specify that end is optional and that if it's not provided, then its value is 0.  I'm just highlighting the fact that some of these terms

@impinball aren't quite concrete and language agnostic enough to prevent some trollish byte counts. :)

The first part that isn't specifying parameters is where I would stat counting (e.g. (defun fn (string &aux (start 0) (end 0) wouldn't count, but everything remaining in the lambda would).

@impinball Everything in the lambda list after &aux is an auxiliary parameter.  The value for start is 0, the value for end is 0, the value for result is (make-array ...), and the value for x is (loop ...).  They're all in the lambda list of the function; the newlines aren't significant here (except as whitespace).  When parameter default values accept arbitrarily complex initialization forms, it becomes problematic to allow exclusion of parameter lists from byte count.

@impinball Even with all that bit about the &aux variables, though, I've posted a more direct version with loop that has a more "according to the spirit" byte count.

php, 204
function s($x){$a=str_split($x);$c=-1;$o=array();
for($i= 0;$i<count($a);$i++){if(ord($a[$i])>=48&&ord($a[$i])<=57)
{$c++;$o[$c]=array();}while(ord($a[$i])>=48&&ord($a[$i])<=57)
{array_push($o[$c],$a[$i]);$i++;}}return $o;}

Descriptive Code:
function splitdigits($input){

    $arr = str_split($input);
    $count = -1;
    $output = array();
    for($i = 0; $i < count($arr); $i++){

    if(ord($arr[$i]) >= 48 && ord($arr[$i]) <= 57){
        $count++;
        $output[$count] = array();
    }

    while(ord($arr[$i]) >= 48 && ord($arr[$i]) <= 57){
        array_push($output[$count], $arr[$i]);
        $i++;
    }

}

return $output;
}

This is pretty long code and I'm sure there will be a much shorter php version for this code golf. This is what I could come up with in php.

there are some improvements: you can replace array() with [], array_push($output[$count], $arr[$i]); with $output[$count][]=$arr[$i];, and the ord() checks with is_numeric(). and you don't even need to split the string to iterate over its characters. also, only the inner code of the function counts, so as it is you char count is 204.

The function declaration doesn't count. Refer to rule 2 as a guide on what counts and what doesn't.

Rebol (66 chars)
remove-each n s: split s complement charset"0123456789"[empty? n]s

Ungolfed and wrapped in function declaration:
f: func [s] [
    remove-each n s: split s complement charset "0123456789" [empty? n]
    s
]

Example code in Rebol console:
>> f "abc123def456"
== ["123" "456"]

>> f "aitew035snk582:3c"
== ["035" "582" "3"]

>> f "as5493tax54\\430-52@g9.fc"
== ["5493" "54" "430" "52" "9"]

>> f {sasprs]torer"re\\forz}
== []

JavaScript, 104 97 89
Golfed:
Edit: When the loops walks off the end of the array, c is undefined, which is falsy and terminates the loop.
2/27: Using ?: saves the wordiness of if/else.
function nums(s) {
s+=l='length';r=[''];for(k=i=0;c=s[i];i++)r[k]+=+c+1?c:r[k+=!!r[k][l]]='';
r[l]--;return r
}

The carriage return in the body is for readability and is not part of the solution.
Ungolfed:
The idea is to append each character to the last entry in the array if it is a digit and to ensure the last array entry is a string otherwise.
function nums(s) {
    var i, e, r, c, k;
    k = 0;
    s+='x'; // ensure the input does not end with a digit
    r=[''];
    for (i=0;i<s.length;i++) {
        c=s[i];
        if (+c+1) { // if the current character is a digit, append it to the last entry
            r[k] += c;
        }
        else { // otherwise, add a new entry if the last entry is not blank
            k+=!!r[k].length;
            r[k] = '';
        }
    }
    r.length--; // strip the last entry, known to be blank
    return r;
}

PHP 98 89
As in DigitalTrauma's bash answer, this doesn't use a regex.
function f($x) {
// Only the following line counts:
for($h=$i=0;sscanf(substr("a$x",$h+=$i),"%[^0-9]%[0-9]%n",$j,$s,$i)>1;)$a[]=$s;return@$a;
}

Test cases:
php > echo json_encode(f("abc123def456")), "\n";
["123","456"]
php > echo json_encode(f("aitew034snk582:3c")), "\n";
["034","582","3"]
php > echo json_encode(f("as5493tax54\\430-52@g9.fc")), "\n";
["5493","54","430","52","9"]
php > echo json_encode(f("sasprs]tore\"re\\forz")), "\n";
null

Python
def find_digits(_input_):
    a,b = [], ""
    for i in list(_input_):
        if i.isdigit(): b += i
        else:
            if b != "": a.append(b)
            b = ""
    if b != "": a.append(b)
    return a

Haskell 31
{-# LANGUAGE OverloadedStrings #-}
import Data.Char (isDigit)
import Data.Text (split)

f=filter(/="").split(not.isDigit)

It splits the string on all non-numeric characters and removes the empty strings generated by consecutive delimiters.

Javascript, 72
function f(a){
 a+=".",b="",c=[];for(i in a)b=+a[i]+1?b+a[i]:b?(c.push(b),""):b;return c
}

Ungolfed
a+=".",b="",c=[];        //add '.' to input so we dont have to check if it ends in a digit
for(i in a)
    b=+a[i]+1?           //check if digit, add to string if it is
        b+a[i]:
    b?                   //if it wasnt a digit and b contains digits push it
        (c.push(b),""):  //into the array c and clear b
    b;                   //else give me b back
return c

Sample input/output
console.log(f("abc123def456"));
console.log(f("aitew034snk582:3c"));
console.log(f("as5493tax54\\430-52@g9.fc"));
console.log(f("sasprs]tore\"re\\forz"));

["123", "456"]
["034", "582", "3"]
["5493", "54", "430", "52", "9"]
[]

JSFiddle

I like it! Much simpler than my own. You can drop another 8 characters by replacing if(+a[i]+1)b+=a[i];else if(b)c.push(b),b="" with b=+a[i]+1?b+a[i]:b?(c.push(b),""):b.

@DocMax thx, I edited to include your suggestion :). That (c.push(b),"") seemed clever, never seen that.

I had forgotten about it until I saw it used extensively earlier today in http://codegolf.stackexchange.com/questions/22268#22279

That's not valid, ' ' is mistaken for 0 and it's a javascript quirk difficult to manage. Try '12 34 56'

VBA 210, 181 without function declaration
Function t(s)
Dim o()
For Each c In Split(StrConv(s,64),Chr(0))
d=IsNumeric(c)
If b And d Then
n=n&c
ElseIf d Then:ReDim Preserve o(l):b=1:n=c
ElseIf b Then:b=0:o(l)=n:l=l+1:End If:Next:t=o
End Function

C, 158
#define p printf
char s[100],c;int z,i;int main(){while(c=getchar())s[z++]=(c>47&&c<58)*c;p("[");for(;i<z;i++)if(s[i]){p("\"");while(s[i])p("%c",s[i++]);p("\",");}p("]");}

Since C doesnt have array print functions built-in I had to do that work on my own so I apologive that there is a final comma in every output. Essentially what that code does is it reads the string if it is not a digit it replaces it with '\0' and then I just loop through the code and print out all of the chains of digits.(EOF=0)

Input: ab5c0x

Output: ["5","0",]

Input: z526ks4f.;8]\p

Output: ["526","4","8",]

According to the question's rules (rule 2), you only have to count the characters in the function body. So your solution would actually be less than 170 bytes. I'm not sure if the count includes variable prototypes outside the function body, though.

I will amend the rules on this: #defines, variable declarations, etc. will count, but the function declaration will not.

Also, last time I checked, there was a type in C notated as char[][] which is legal. If you return as that (or char**), you will be fine.

It doesn't have To be text output? I though the program was supposed to output the array in a string format

C#, 98
static string[] SplitAtNonDigits(string s)
{
    return new string(s.Select(c=>47<c&c<58?c:',').ToArray()).Split(new[]{','},(StringSplitOptions)1);
}

First, this uses the LINQ .Select() extension method to turn all non-digits into commas. string.Replace() would be preferable, since it returns a string rather than a IEnumerable<char>, but string.Replace() can only take a single char or string and can't make use of a predicate like char.IsDigit() or 47<c&c<58.
As mentioned, .Select() applied to a string returns an IEnumerable<char>, so we need to turn it back into a string by turning it into an array and passing the array into the string constructor.
Finally, we split the string at commas using string.Split(). (StringSplitOptions)1 is a shorter way of saying StringSplitOptions.RemoveEmptyEntries, which will automatically takes care of multiple consecutive commas and commas at the start/end of the string.

Instead of char.IsDigit(c), you can use '/'<c&&c<':'

Good point...or even better, 47<c&&c<58. (Frankly, I'm surprised it works with numbers, but apparently it does).

And I can save an extra valuable character by using a single '&' instead of a double '&&'. In C#, this still logical AND when both operands are booleans -- it only does a bitwise AND when they're integers.

Nice one. I didn't know it was able to do that.

A slightly shorter variant is to split on white space instead of ,, and then manually remove the empty items return new string(s.Select(c=>47<c&c<58?c:' ').ToArray()).Split().Where(a=>a!="").ToArray();

Python 104 83
def f(s, o=[], c=""):
    for i in s:
        try:int(i);c+=i
        except:o+=[c];c=""
    return [i for i in o+[c] if i]

@Abhijit answer is far clever, this is just a "minified" version of what i had in mind.
assert f("abc123def456") == ["123", "456"]
assert f("aitew034snk582:3c") == ["034", "582", "3"]
assert f("as5493tax54\\430-52@g9.fc") == ["5493", "54", "430", "52", "9"]
assert f("sasprs]tore\"re\\forz") == []

This yields no output, so the code is working, if ran one by one, as some variables are defined at the declaration.

You don't have to count the function declaration, if you did. Just as a heads up

JavaScript, 240 bytes
And for those of you who are curious, here's my probably huge golf:
function split(a) { // begin function
function f(c){for(var a=-1,d=9;d--;){var e=c.indexOf(d+"");0
>e||e<a&&(a=e)}return 0<a?a:null}var c=f(a);if(null==c)retur
n null;var d=[];for(i=0;;){a=a.substring(c);d[i]||(d[i]="");
c=f(a);if(null==c)break;d[i]+=a.charAt(c);0<c&&i++}return d;
} // end function

Above in pretty print:
function split(a) {
    function f(c) {
        for (var a = -1, d = 9;d--;) {
            var e = c.indexOf(d + "");
            0 > e || e < a && (a = e);
        }
        return 0 < a ? a : null;
    }
    var c = f(a);
    if (null == c) return null;
    var d = [];
    for (i = 0;;) {
        a = a.substring(c);
        d[i] || (d[i] = "");
        c = f(a);
        if (null == c) break;
        d[i] += a.charAt(c);
        0 < c && i++;
    }
    return d;
}

Above in normal descriptive code
function split(a) {
    function findLoop(string) {
        var lowest = -1;
        var i = 9;
        while (i--) {
            var index = string.indexOf(i + '');
            if (index < 0) continue;
            if (index < lowest) lowest = index;
        }
        return (lowest > 0) ? lowest : null;
    }
    var index = findLoop(a);
    if (index == null) return null;
    var ret = [];
    i = 0;
    for ( ; ; ) {
        a = a.substring(index);
        if (!ret[i]) ret[i] = '';
        index = findLoop(a);
        if (index == null) break;
        ret[i] += a.charAt(index);
        if (index > 0) i++;
    }
    return ret;
}

PHP 134
function f($a){
$i=0;while($i<strlen($a)){!is_numeric($a[$i])&&$a[$i]='-';$i++;}return array_filter(explode('-',$a),function($v){return!empty($v);});
}

You can shorten it by leaving out the callback at array_filter. This will automatically remove all entries which are false when they're casted to booleans.

@kelunik that would filter out 0s as well

Ruby, 24
f=->s{s.tr("
-/:-~",' ').split}

Defines digits using negative space within the printable ascii range.

Function declaration doesn't count.

JS/Node : 168 162 147 138 Chars
function n(s){
var r=[];s.split('').reduce(function(p,c){if(!isNaN(parseInt(c))){if(p)r.push([]);r[r.length-1].push(c);return 0;}return 1;},1);return r;
}

Beautified version:
function n(s) {
  var r = [];
  s.split('').reduce(function (p, c) {
    if (!isNaN(parseInt(c))) {
      if (p) {
        r.push([]);
      }
      r[r.length - 1].push(c);
      return 0;
    }
    return 1;
  }, 1);
  return r;
}

This question only wants the array returned, so you can remove console.log(r) and some other things

The function declaration doesn't count toward the score (reason is to help level the playing field)

Ok. Adjusted the score as per @impinball's comment. (Actually there are two functions declared here. Char count includes the anonymous function)

It should. I updated the rules to help explain it better.

Meanwhile, came up with something better...

R 52
This function splits strings by character class (this is not regex! :)) class is N - numeric characters and P{N} means negation of this class. o=T means omit empty substrings.
x
## [1] "wNEKbS0q7hAXRVCF6I4S" "DpqW50YfaDMURB8micYd" "gwSuYstMGi8H7gDAoHJu"
require(stringi)
stri_split_charclass(x,"\\P{N}",o=T)
## [[1]]
## [1] "0" "7" "6" "4"

## [[2]]
## [1] "50" "8"

## [[3]]
## [1] "8" "7"

PHP 99
<?php

$a = function($s) {
foreach(str_split($s)as$c)$b[]=is_numeric($c)?$c:".";return array_filter(explode('.',implode($b)));
};

var_dump($a("abc123def456"));
var_dump($a("aitew034snk582:3c"));
var_dump($a("as5493tax54\\430-52@g9.fc"));
var_dump($a("sasprs]tore\"re\\forz"));

Output
array(2) {
  [3]=>
  string(3) "123"
  [6]=>
  string(3) "456"
}
array(3) {
  [5]=>
  string(3) "034"
  [8]=>
  string(3) "582"
  [9]=>
  string(1) "3"
}
array(5) {
  [2]=>
  string(4) "5493"
  [5]=>
  string(2) "54"
  [6]=>
  string(3) "430"
  [7]=>
  string(2) "52"
  [9]=>
  string(1) "9"
}
array(0) {
}

JavaScript 88
88 chars when not counting function n(x){}
function n(x){
y=[],i=0,z=t=''
while(z=x[i++])t=!isNaN(z)?t+z:t&&y.push(t)?'':t
if(t)y.push(t)
return y
}

Racket 149
Golfed (according to the rules, only the length of the second line counts)
(define (extract-numeric-substrings s)
(let L([x(map string->number(string-split s""))])(set! x(dropf x false?))(if(null? x)x(let-values([(h t)(splitf-at x number?)])(cons(apply ~a h)(L t)
)))))

Ungolfed
(define (extract-numeric-substrings s)
  (let L ([x (map string->number (string-split s ""))])
    (set! x (dropf x false?))
    (if (null? x)
        x
        (let-values([(h t) (splitf-at x number?)])
          (cons (apply ~a h) (L t))))))

Results
(map extract-numeric-substrings '("abc123def456"
"aitew034snk582:3c"
"as5493tax54\\430-52@g9.fc"
"sasprs]tore\"re\\forz"))

'(("123" "456")
("034" "582" "3")
("5493" "54" "430" "52" "9")
())

Javascript with lambdas, 84
extract=s=>[].reduce.call(s,(r,c)=>r+=(c!=+c?r[r.length-1]==" "?"":" ":c),"").trim().split(" ")

Tested in Firefox 27

VB.NET, 87
Imports System.Console
Imports System.String
Imports System.Char
Imports System.StringSplitOptions

Module All
  Public Function Parse(S As String) As String()
    Return Join("",From C In S Select If(IsDigit(C),C," ")).Split({" "},RemoveEmptyEntries)
  End Function

  Public Sub Main()
    For Each S As String In {"abc123def456", "aitew034snk582:3c", "as5493tax54\\430-52@g9.fc", "sasprs]tore\""re\\forz"}
      WriteLine(Join(":", Parse(S)))
    Next S
  End Sub
End Module

According the rules, only content of parse function is calculated:
Return Join("",From C In S Select If(IsDigit(C),C," ")).Split({" "},RemoveEmptyEntries)

Haskell 37
I am not counting the imports towards the bytecount, as per the scoring rules. The body of the code is a 1 liner (with semicolons, so there is actually no advantage other than looking more golfed), though I am not sure what to count and what not to count in the function definitions. This was originally longer, but I got inspiration from Coaumdio's and DigitalTrauma's bash solutions.
import Data.Char {-Not counted-}
i x|isDigit x=x;i _=' ';f=words.map i {-Fully Counted-}

i preserves digit characters, and replaces all other characters with space. f just maps i onto a string and then applies words, which splits a string into a list of substrings that were separated by arbitrarily long runs of whitespace. If I am missing any of the rules whereby I can reduce my bytecount by omitting certain characters from the score, I would appreciate comments to that effect.

APL: 22
{(a/1,2</a)⊂⍵/⍨a←⍵∊⎕D}

Explanation:
a←⍵∊⎕D creates boolean of argument (⍵) being a digit (system variable ⎕D contains '0123456789')

⍵/⍨a  takes just the numeric part of the argument

(a/1,2</a)⊂  makes substrings of numbers only, starting at first number found

Pharo Smalltalk, 60
f:=[:s|(s splitOn:[:e|e isDigit not])reject:[:e|e isEmpty]]

Outputs:
f value:'abc123def456' -> OrderedCollection('123' '456')
f value:'aitew034snk582:3c' -> OrderedCollection('034' '582' '3')
f value:'as5493tax54\430-52@g9.fc' -> OrderedCollection('5493' '54' '430' '52' '9')
f value:'sasprs]tore\"re\forz' -> OrderedCollection()

C (gcc), 50 bytes
Note that the TIO counts 48, that is because it doesn't count the global at the top
c;
void split(unsigned char *s, unsigned char **a) {
for(c=0;*s;s++)c=*s-48u>9?*s=0:c?:(*a++=s);*a=0;
}

Try it online!
Significant improvement of Coaumdio's algorithm which I would comment on, but the user hasn't been active since then.
The most notable difference is that it uses unsigned char * instead of char *. This is because the function signature is free, and it allows us to do unsigned arithmetic instead of ctype. This doesn't affect the test cases, but if we were to have a character with the high bit set, it would.
for(c=0;*s;s++)

I moved the variable to a global variable with implicit int and initialized in the for loop. Saves 3 bytes.
Otherwise, this simply loops through s until it reaches the null terminator.
Now to explain this glorious hot garbage.
c=*s-48u>9?*s=0:c?:(*a++=s);

Let's format it a little better, convert it to an if-else, and step through it.
Overview of the logic:
if (*s - (unsigned)'0' > 9) { // c=*s-48u>9?
    c = *s = '\0';            //   *s=0
} else if (c != 0) {          // :c?
    c = c;                    //   // implicit: c
} else {                      // :
    c = (int)(*a++ = s);      //   (*a++ = s)
}                             // ;

if (*s - (unsigned)'0' > 9) { // c=*s-48u>9?

Thanks to unsigned arithmetic, we can remove the isdigit call entirely.
Basically, what the subtraction does is an unsigned subtraction, with negatives being converted to really big positives.
So for example:
' ' = 32 - 48 = -16 = 4294967280 (for a 32-bit int)
'0' = 48 - 48 = 0 = 0
'9' = 54 - 48 = 9 = 9
'A' = 65 - 48 = 17 = 17

As you can see, '0' to '9' will be turned into 0-9, and anything else will be larger than that, so we can just check if the result of the subtraction is greater than 9.
    c = *s = '\0';            //   *s=0

If it is not a digit, we will replace the contents of *s with a '\0' byte. The result of this assignment makes the ternary return 0, also assigning c to 0.
} else if (c != 0) {          // :c?
    c = c;                    //   // implicit: c

If it is a digit and c is set, we set it to itself using GCC's ?: extension, which evaluates to the condition itself for true if the middle of the ternary is left out.
} else {                      // :
    c = (int)(*a++ = s);      //   (*a++ = s)
}                             // ;

Last, if it is a digit and c is not set, we will store s into a and advance it, and here is the disgusting part: We then use the result of that assignment to set c to a non-zero value...assigning an integer to a pointer.
*a=0;

Finally, we NULL terminate a and return.

C# 66
static char[] n(string s){return s.Where(Char.IsDigit).ToArray();}

This is not a valid solution, I don't think the OP wants you to split on the empty string ;)

source: Stack Exchange

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

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

sort: votes


text:
Reverse Regular expressions
The idea here is to write a little segment that will spit out regular expression patterns when given a string that matches them.
As you might have guessed, this will be a popularity contest, and I'll accept whichever answer has the most upvotes by March 7th
pseudocode Example:
print(reverseRegex('dog'));
//prints /[a-z]{3}/, /dog/, and a bunch other stuff

EDIT: The regular expressions spat out should not exceed 3 times the input string's length

I think the spec could do with tightening. There are countably infinitely many families of countably infinitely many regexes which match any given string.

What if the input string is longer than 30 chars?

@doorknob good point, will revise again

Now your sample output violates your own rules.

Will fix :P where would I be without you...

Maybe in the sandbox: http://meta.codegolf.stackexchange.com/questions/954/proposed-questions-sandbox-mark-8

Ruby
def esc chr
  '\\[]'.index(chr) ? "\\#{chr}" : chr
end

def reverse_regex str
  ords = str.chars.to_a.uniq.map(&:ord).sort
  prev = ords.first
  ranges = ords.slice_before{|x|
    prev, prev2 = x, prev
    prev2 + 1 != x
  }.map{|x| x[0]..x[-1]}

  reversed = "[#{ranges.map{|c|esc(c.min.chr) + (c.min == c.max ? '' : (c.min + 1 == c.max ? '' : '-') + esc(c.max.chr))}*''}]{#{str.size}}"
  reversed.size > str.size * 3 ? /#{Regexp.escape str}/ : /#{reversed}/
end

Sample outputs:
reverse_regex 'dogs are delicious'
  => /[ ac-egilorsu]{18}/
reverse_regex 'a'
  => /a/
reverse_regex ''
  => //
reverse_regex 'This is a test: []{}.*potato'
  => /[ *.:T\[\]aehiopst{}]{28}/

Now with ranges!
These regexen match the entire string (if you added ^...$ it would still match, but I'm too lazy to do that and add the required length check). Also, I'm assuming the /s don't count for length. (If they did, it would be impossible for input of empty string.)

Python 3.2
If you wish for soemthing very short, as usual you can use python.
It is well known that you can do anything in python with few imports. In this case, this task is such simple that in python 3.2 you don't even need an include.
def reverse_regex(string):
    return '/.*/'

print (reverse_regex('dog'))
print (reverse_regex('I can haz a cheezburger.'))
print (reverse_regex('123-ABC-abc'))

You will see all these expression are valid.
UPDATE:
This new code (although a bit more long) is able to show multiple regex for eacah word.
def reverse_regex(string):
    print ('/.*/')
    print ('/'+string+'/')

reverse_regex('dog')
reverse_regex('I can haz a cheezburger.')
reverse_regex('123-ABC-abc')

the idea is that it should spit out different expressions for each string, and more than one of them

thx, corrected.

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


text:
Crossword Compulsions!
Chris, a cryptic crosswords addict, has a set algorithm for the order in which he solves them.

We will use the above image as a guide.

Chris always starts off with the first across clue, in this case 1 Across. Chris is a capable crossword enthusiast, so it is assumed that he will always know the answer to the clue he is working on.
Once Chris completes a clue, he will check for all clues adjoining those he has completed (in the first case, 1 Down, 2 Down and 3 Down) and then complete the clue with the lowest number. If there are no adjoining clues, he would go to step 3.
If the clue is such that the next number (as described in Step 3) has both an across clue and a down clue, he will complete the across clue first (100% certainty, this borders on OCD!)
If there are no adjoining clues, he will go to the next available clue that's next in number (across or down)
Repeat from Step 2 until all clues are completed.

And this is where it comes down to you, dear coders. You have been tasked to create code that can, on being provided with a crossword template, provide output describing the order of clues based on Chris's algorithm for solving it.
The code will accept input of a crossword puzzle template, in the form of a . representing a white square and a # representing a black square.
Example:
.....#.........
.#.#.#.#.#.#.#.
...#...#.......
.#.#.#.#.#.#.#.
....#..........
##.#.#.#.#.#.#.
......#........
.###.#####.###.
........#......
.#.#.#.#.#.#.##
..........#....
.#.#.#.#.#.#.#.
.......#...#...
.#.#.#.#.#.#.#.
.........#.....

Input can be through: a) a file read of the representation of the crossword, or b) by line input of each line of the crossword, followed by \n, with a second \n indicating EOF.
And then it will determine the method by which Chris would solve it according to the above algorithm he has described.
Output must be in the format of a series of comma separated instructions in the form of n(A|D), where n is the clue number followed by A for across or D for down.
So in the example above (both from the image, and the example template, which are the one and the same), the output would be:
1A,1D,2D,3D,9A,10A,4D,5D,6D,7D,8D,11A,12A,13A,15A,14D,15D,16A,17A,18D,19D,20A,21D,23A,22D,24A,25D,27A,28A,26D,29A,30A,31A
Shortest code wins...
Testing
You must provide with your submission the code, a byte count, as well as one of the four test cases represented in the . and # format, as well as the output generated from this input. There are four test cases, the three below as well as the above example template.
Example test cases:
Test Case 1
.....#
.#.#.#
...#..
.#.#.#
.....#
##.#..

Output: 1A,1D,2D,3D,4A,5A,6A,7A
Test Case 2
.....#..
.#.##..#
.#....#.
...##.#.
.####...
......##

Output: 1A,1D,2D,5A,4D,4A,3D,3A,7A,8A,6D,9A
Test Case 3
.........#
#.#.#.#.#.
....#...#.
#...#.#.#.
..###.#.#.
.#....#...
.#####...#
.....###..

Output: 1A,2D,3D,4D,5D,7A,8A,9A,10A,11A,11D,12A,13A,6D,14D,15A,16A,17A
Test Case 4
.....#.........
.#.#.#.#.#.#.#.
...#...#.......
.#.#.#.#.#.#.#.
....#..........
##.#.#.#.#.#.#.
......#........
.###.#####.###.
........#......
.#.#.#.#.#.#.##
..........#....
.#.#.#.#.#.#.#.
.......#...#...
.#.#.#.#.#.#.#.
.........#.....

Output: 1A,1D,2D,3D,9A,10A,4D,4A,5D,6D,7D,8D,11A,12A,13A,15A,14D,15D,16A,17A,18D,19D,20A,21D,23A,22D,24A,25D,27A,28A,26D,29A,30A,31A
Good luck!

Just to be sure: In your example image, which number is the fifth clue to be compulsively filled? (after 1H, 1V, 2V, 3V)

@belisarius The image corresponds to the fourth test case. So the fifth clue to be filled would be 9 Across, or as you would put it, 9H :) As The only adjoining clues after the fourth clue is completed are 9 and 10 Across, Chris will be compelled to fill in the lowest clue first...

Are the bytes considered only on the basis of the code that produces the correct output. IOW, are you penalized on includes, C# namespace + class + Main, and the like in order to have it compilable or is it reasonable to assume that if I write it in C#, or similar, that minimal amount of code would be required?

@BobbyDigital Well, this is code-golf... I would hope that if you did plan on writing it in C# you would try not to use too many externals... You'd have to count them I'm afraid...

@WallyWest I thinkg your third example is omitting a 17A at the end. Also the fourth the 4A right after 4D.

@Howard, thank you for that... I posted this on Meta late one night, so I must have been a little tired and missed those two... Fixed now. +1 to you. You'll have a crack at it?

In the final test case, why does 4D precede 4A, when 1A precedes 1D?  Just because it will intersect an already filled square from 10A?

Hey @Jonah, to be honest, given this question is now some seven years old, I haven’t looked at it for some time... if there is a mistake, chances are I missed something in the proofing of this original post... possibly due to fatigue as I posted this somewhat late at night... I’ll have a look shortly... thanks for bringing this to my attention...

GolfScript, 154 characters
:^,,{.^=46<{;-1}*)}%[.^n?)/zip[0]*]{1,%{,1>},}%:H"AD"1/]zip{~`{1$0=H{{0=}/}%.&$?)\+[\]}+/}%(2/\{0=)[\~\]}$+[]{1${1=1$&},.!{;1$1<}*1<:F~~@|@F-\1$}do;;]','*

Input has to be provided on STDIN. The examples yield the following results (check online):
1A,1D,2D,3D,4A,5A,6A,7A

1A,1D,2D,5A,4D,4A,3D,3A,7A,8A,6D,9A

1A,2D,3D,4D,5D,7A,8D,9A,10A,11A,11D,12A,13A,6D,14D,15A,16A,17A

1A,1D,2D,3D,9A,10A,4D,4A,5D,6D,7D,8D,11A,12A,13A,15A,14D,15D,16A,17A,18D,19D,20A,21D,23A,22D,24A,25D,27A,28A,26D,29A,30A,31A

+1 Remarkably succinct. How does it work?

Wow, thanks for making it clear that I should not even waste my time. Clearly going to have to get on top of a more appropriate language. votes++

@BobbyDigital I meant no disrespect. C# is a very verbose language... it's probably not the best for code golf. Code-bowling or for popularity contests on here... but Code Golf is a whole new kettle of fish.

+1 here too... Probably one of the longer GolfScript entries I've seen... Nicely done.

@WallyWest: None taken. Yes it is, I was still going to try, that is, until I saw Howard's.  It's the first I've heard of GolfScipt. As soon as I get some free time I'm going to give it a go and come back.

@BobbyDigital: The task itself is quite interesting. Give it a try in a language you are familiar with. I think you'll enjoy the puzzle as much as I did - investigate all the different approaches to tackle the puzzle. It is fun by itself even if you don't reach a character count as low as this answer.

Mathematica 806 477
(There appears to be a glitch in the ordering of the solution steps.  I am looking into this.)
Golfed
The function q finds the order of the crossword solutions.
i = Dimensions; v = MemberQ; u = Position; y = ToString; k = Select;
q@t_ :=
 (g@p_ := Characters@StringSplit[p, "\n"];
  w = g@t;
  a[{r_, c_}, z_] := (c != i[z][[2]]) \[And]
    v[u[z, "."], {r, c + 1}] \[And] ((c == 1) \[Or]
      v[u[z, "#"], {r, c - 1}]);
  b@z_ := k[u[z, "."], a[#, z] &];
  d[{r_, c_}, z_] := (r != i[z][[2]]) \[And]
    v[u[z, "."], {r + 1, c}] \[And] ((r == 1) \[Or]
      v[u[z, "#"], {r - 1, c}]);
  e@z_ := k[u[z, "."], d[#, z] &];
  Cases[Flatten[{
       If[v[b[w], #[[1]]], y[#[[2]]] <> "A"],
       If[v[e[w], #[[1]]], y[#[[2]]] <> "D"]} & /@ (MapIndexed[List,
        b[w] \[Union] e[w]] /. {{r_, c_}, {i_}} :> ({r, c} -> i))],
   Except[Null]])

Ungolfed
q[t7_]:=
Module[{d,acrossSquareQ,acrossSquares,downSquareQ,downSquares,m,numberedCells},
(*w=g[t7];*)
g[p2_]:=Characters@StringSplit[p2,"\n"];
w=g[t7];
acrossSquareQ[{r_,c_},z_]:=(c!=Dimensions[z][[2]])\[And]MemberQ[Position[z,"."],{r,c+1}] \[And]((c==1)\[Or]MemberQ[Position[z,"#"],{r,c-1}]);
acrossSquares[z_]:=Select[Position[z,"."],acrossSquareQ[#,z]&];
downSquareQ[{r_,c_},z_]:=(r!=Dimensions[z][[2]])\[And]MemberQ[Position[z,"."],{r+1,c}] \[And]((r==1)\[Or]MemberQ[Position[z,"#"],{r-1,c}]);
downSquares[z_]:=Select[Position[z,"."],downSquareQ[#,z]&];
numberedCells[z_]:=acrossSquares[z]\[Union]downSquares[z];
m=MapIndexed[List,numberedCells[w]]/.{{r_?IntegerQ,c_?IntegerQ},{i_?IntegerQ}}:> ({r,c}-> i);
Cases[Flatten[{
If[MemberQ[acrossSquares[w],#[[1]]],ToString[#[[2]]]<>"A"],
If[MemberQ[downSquares[w],#[[1]]],ToString[#[[2]]]<>"D"]}&/@m],Except[Null]]]

board displays the crossword puzzle.  The code is not included in the character count. Several sub functions from q are borrowed here.
board[p_]:=
Module[{q,g,w,downSquareQ,downSquares,acrossSquareQ,acrossSquares,numberedCells,m},
downSquareQ[{r_,c_},z_]:=(r!=Dimensions[z][[2]])\[And]MemberQ[Position[z,"."],{r+1,c}] \[And]((r==1)\[Or]MemberQ[Position[z,"#"],{r-1,c}]);
downSquares[z_]:=Select[Position[z,"."],downSquareQ[#,z]&];
acrossSquareQ[{r_,c_},z_]:=(c!=Dimensions[z][[2]])\[And]MemberQ[Position[z,"."],{r,c+1}] \[And]((c==1)\[Or]MemberQ[Position[z,"#"],{r,c-1}]);
acrossSquares[z_]:=Select[Position[z,"."],acrossSquareQ[#,z]&];
numberedCells[z_]:=acrossSquares[z]\[Union]downSquares[z];
g[p2_]:=Characters@StringSplit[p2,"\n"];
w=g[p];
m=MapIndexed[List,numberedCells[w]]/.{{r_?IntegerQ,c_?IntegerQ},{i_?IntegerQ}}:> ({r,c}-> i);
Grid[ReplacePart[w,m],Dividers->All,Background->{None,None,(#-> Black)&/@Position[w,"#"]}]]

TestCases
1
t1=".....#
.#.#.#
...#..
.#.#.#
.....#
##.#..";
board[t1]
q[t1]

{"1A", "1D", "2D", "3D", "4A", "5A", "6A", "7A"}

2
t2=".....#..
.#.##..#
.#....#.
...##.#.
.####...
......##";

board[t2]
q[t2]

{"1A", "1D", "2D", "3A", "3D", "4A", "4D", "5A", "6D", "7A", "8A",
  "9A"}

3
t3=".........#
#.#.#.#.#.
....#...#.
#...#.#.#.
..###.#.#.
.#....#...
.#####...#
.....###..";

board[t3]

q[t3]

{"1A", "2D", "3D", "4D", "5D", "6D", "7A", "8D", "9A", "10A", "11A", "11D", "12A", "13A", "14D", "15A", "16A", "17A"}

4
t4=".....#.........
.#.#.#.#.#.#.#.
...#...#.......
.#.#.#.#.#.#.#.
....#..........
##.#.#.#.#.#.#.
......#........
.###.#####.###.
........#......
.#.#.#.#.#.#.##
..........#....
.#.#.#.#.#.#.#.
.......#...#...
.#.#.#.#.#.#.#.
.........#.....";

board[t4]

q[t4]

{"1A", "1D", "2D", "3D", "4A", "4D", "5D", "6D", "7D", "8D", "9A",
  "10A", "11A", "12A", "13A", "14D", "15A", "15D", "16A", "17A", "18D",
  "19D", "20A", "21D", "22D", "23A", "24A", "25D", "26D", "27A", "28A",
  "29A", "30A", "31A"}

I think you have an issue with your code. E.g. in example 2 the 3A should no be right after the 2D because there is no clue yet. Also the other solutions show this effect.

Howard, I am not understanding your point. From "4. If there are no adjoining clues, he will go to the next available clue that's next in number (across or down)", it appears that 3A may be after 2D.

But e.g. 5A has a clue and should therefore be favoured over 3A.

You've defined a shorthand for ToString twice

Howard, Now I understand your point. Thanks. Will correct later.

belisarius, thanks, that's the first of many edits I will need to do.  The others will have to wait for now, due to other pressing tasks.

@DavidCarraher Nice work so far... Can't wait to see the finished result.


text:
Convert degrees to one of the 32 points of the compass
The 32-point compass is... interesting, to say the least.

By Denelson83 (Own work) [GFDL or CC-BY-SA-3.0], via Wikimedia Commons
Your challenge is to take a degree measure, and convert it into a direction on the 32-point compass.
Each direction is 11.25 (360 / 32) degrees farther than the previous. For example, N (north) is 0 degrees, NbE (north by east) is 11.25 degrees, NNE (north-northeast) is 22.5 degrees, etc.
As for how you're supposed to get the directions,

0 degrees is N, 90 degrees is E, 180 degrees is S, and 270 degrees is W.

These are called cardinal directions.

The halfway points between the cardinal directions are simply the cardinal directions they're between concatenated. N or S always go first, and W or E always are second.

These are called ordinal directions.

The halfway points between the cardinal and ordinal directions are the directions they're between concatenated, again, with a "-" in between. Cardinal directions go first, ordinal second.

These are called secondary-intercardinal directions.

The halfway points between secondary-intercardinal directions and other directions are the other directions "by" the cardinal direction they're closest to (other than the one directly next to them, of course).

I have no idea what these are called :P

If all this explanation hurts your brain as much as mine, you can refer to this chart:
1   North               N
2   North by east       NbE
3   North-northeast     NNE
4   Northeast by north  NEbN
5   Northeast           NE
6   Northeast by east   NEbE
7   East-northeast      ENE
8   East by north       EbN
9   East                E
10  East by south       EbS
11  East-southeast      ESE
12  Southeast by east   SEbE
13  Southeast           SE
14  Southeast by south  SEbS
15  South-southeast     SSE
16  South by east       SbE
17  South               S
18  South by west       SbW
19  South-southwest     SSW
20  Southwest by south  SWbS
21  Southwest           SW
22  Southwest by west   SWbW
23  West-southwest      WSW
24  West by south       WbS
25  West                W
26  West by north       WbN
27  West-northwest      WNW
28  Northwest by west   NWbW
29  Northwest           NW
30  Northwest by north  NWbN
31  North-northwest     NNW
32  North by west       NbW

Here is a more detailed chart and possibly better explanation of the points of the compass.
Your challenge is to take input in degrees, and output the full name of the compass direction it corresponds to, along with its abbreviation.
Test cases:
Input  Output
0      North N
23.97  North-northeast NNE
33.7   Northeast by north NEbN
73.12  East-northeast ENE
73.13  East by north EbN
219    Southwest by south SWbS
275    West W
276    West by north WbN
287    West-northwest WNW

All capitalization must be preserved, as in the test cases. Maximum number of decimal places is 2. All input numbers will be greater than or equal to 0, and less than 360. If a decimal point is present, there will be digits on both sides (you don't have to handle .1 or 1.).
This is code-golf, so the shortest code in bytes wins.

@WallyWest Hmm, this one allows arrays, has different capitalization, and has no "between," but I didn't notice that (possibly because of the... interesting title :P). I'll see what I can do to make it different enough...

@WallyWest There, now you have to output the abbreviation too. Along with all the other differences, that should be enough to make it a non-dup. (oh, also this one has dashes too)

@WallyWest There be no answers in "R" to your previous question (there weren't even any in "C"!) I hopes we'll see some this time, shipmates!

Would have been more fun if there were input from -360 to 360 degree (negative means anti-clockwise) and a bonus!.

For people not looking for a challenge, the easy solution is to find the possible output for which the distance is minimal from the input angle, using a lookup table angle <-> name.

Perl, 250 236 231 188 187
Edit: Some bytes off exploiting symmetry (as I've seen in @bazzargh solution)
+Edit: And some evil tricks...
+Edit: Back to where I started (working with list, not string), and exploiting more symmetry = 1 byte off and a whole lot uglier.
$_=((@_=(1,@_=qw(1b3 1-13 13b1 13 13b3 3-13 3b1),3,map{y/1/2/r}reverse@_)),map{y/312/421/r}@_)[int<>/11.25+.5];print ucfirst s/\w/(' by ',north,south,east,west)[$&]/ger,' ',y/1-4-/NSEW/dr

Pretty-printed:
$_=(
    (@_=
        (
            1,
            @_=qw(1b3 1-13 13b1 13 13b3 3-13 3b1),
            3,
            map{y/1/2/r}reverse@_
        )
    ),map{y/312/421/r}@_
)[int<>/11.25+.5];

print ucfirst s/\w/(' by ',north,south,east,west)[$&]/ger,' ',y/1-4-/NSEW/dr

5.014 required because of r modifier.

You have a typo in your code: sourth should be south (2nd statement that starts with s/b/ by ...

Those first 3 regexps can be replaced by y/NS/SN/; for 10 chars

@bazzargh, yes, and not only that ;-)

Javascript 470 453 438 434 432 421 404
s=String;s.prototype.a=s.prototype.replace;var a=prompt()/11.25,a=a+0.5|0,b,k,c=a,d=c%8,c=c/8|0,e=["north","east","south","west"],f,g,h;f=e[c];g=e[(c+1)%4];h=f==e[0]|f==e[2]?f+g:g+f;b="1;1 by 2;1-C;C by 1;C;C by 2;2-C;2 by 1".split(";")[d].a(1,f).a(2,g).a("C",h);k=b.a(/north/g,"N").a(/east/g,"E").a(/south/g,"S").a(/west/g,"W").a(/by/g,"b").a(/[\s-]/g,"");b=b[0].toUpperCase()+b.slice(1);alert(b+" "+k)

You can copy this code to your console and execute it. It prompts you for the degrees input and outputs the result with alert();
Ungolfed Javascript can be found at this fiddle:
http://jsfiddle.net/AezL3/11

+1 Nice but be careful : "All capitalization must be preserved, as in the test cases."

@BenH Which test case fails the capitalization check? Thanks for this, btw. This came in handy for my web interface I'm writing.

By the way, this does die for 355 degrees to 360 degrees. The fix is easy. Just make calcPoint(32) do what 0 does, so you can do this with %32 or any similar.

@StevenLu it took me a while to figure out what you means, but this line var name = calcPoint(input % 32); does the trick

Haskell 415 372 347 330 317 304 301C
Ended up converging on a solution like @VadimR's (and the symmetry's back!). Usage: h 219 outputs "Southwest by south SWbS"
d"N"="north"
d"S"="south"
d"E"="east"
d"W"="west"
d"b"=" by "
d"-"="-"
d(x:y)=d[x]++d y
e(x:y)=x:tail(d$x:y)
k 'N'='S'
k 'S'='N'
k 'E'='W'
k x=x
r="N NbE N-NE NEbN NE NEbE E-NE EbN E EbS E-SE SEbE SE SEbS S-SE SbE "
p=words$r++(map k r)
g x=p!!mod(round$x/11.25)32
h x=e(g x)++(filter(/='-')$' ':g x)

3 more chars gone, thanks @shiona.

drop 1 is same as tail. Also if I'm not mistaken you can do e l@(x:_)=x:tail$d l to shave still one more char.

can't believe I missed that. Thanks!

Python 3.8, 482 438 424 bytes
lambda h:' '.join([b(h),a(a(a(b(h)),1),d={' by ':'b','-':''})])
L=str.lower
c={'North':'N','East':'E','South':'S','West':'W'}
a=lambda t,l=0,d=c:[*(t:=t.replace([i,L(i)][l],d[i])for i in[*d])][-1]
b=lambda h,k=[*c]:a('W|W by x|W-z|Z by w|Z|Z by x|X-z|X by w'.split('|')[int((q:=h*4/45+.5)%8)],d={'W':(W:=[*k][(v:=int(q//8)%4)]),'X':(X:=[*k][(v+1)%4]),'w':(w:=L(W)),'x':(x:=L(X)),'Z':(Z:=[W+x,X+w][W in'EastWest']),'z':L(Z)})

Try it online!
This is what I got after some golfing of tony goodwin's answer; posted at its own answer due to the TIO link being too long for a comment. If he chooses to update his answer to the above, I will delete this answer.
I am assuming that it's acceptable to submit a function as a solution rather than a full program. If not, here is a full program at 426 bytes.
I expect that much can still be done to shorten b.
Edit: Golfed off 44 bytes, courtesy of the majestic walrus. Still don't feel like b is done being golfed.
Edit2: Shaved off another 14 by unpacking dicts instead of using keys() and items().

Python, 2103 1647 1103 1034 924 889 848 bytes
Very late, I know.  Thanks for the challenge, I am setting up a magnetometer for wind direction with my Pi, and wanted a 16 point of compass solution like this to feed into weather forecasting algorithms.  All my code is in Python, so here is version of the javascript solution already posted in Python, but with an extra twist that you can specify either 32, 16, or 8 points of the compass at variable j, and I have changed the offset of degHead in the statement before it, depending on the number of points.  I used a modified rename alogorithm (and used variables I could rename without corrupting the words!) to ensure I met the case requirements of the question.
I know this won't win, as Python is more wordy, and so am I.
Short version:
  def a(t,d,l):
    for i,j in d.items():
      if l:
        i=i.lower()
      t=t.replace(i,j)
    return t
  def b(h,q):
    p=32
    r=360
    h=(h+(r/q/2))/(r/p)
    j=int(int(int(h %8)%8/(p/q))*p/q)
    h=int(h/8)%4
    k=c.keys()
    u=['W','W by x','W-z','Z by w','Z','Z by x','X-z','X by w']
    d={}
    d['W']=list(k)[h]
    d['w']=d['W'].lower()
    d['X']=list(k)[(h+1)%4]
    d['x']=d['X'].lower()
    if(d['W']=='North' or d['W']=='South'):
      d['Z']=d['W']+d['x']
    else:
      d['Z']=d['X']+d['w']
    d['z']=d['Z'].lower()
    return a(u[j],d,0)
  def g(n):
    n=a(n,c,0)
    n=a(n,c,1)
    d={'by':'b',' ':'','-':''}
    return a(n,d,0)
  def v(m):
    while True:
      try:
        return float(input(m))
      except ValueError:
        print("?")
  c={'North':'N','East':'E','South':'S','West':'W'}
  while True:
    h=v("?")
    n=b(h,32)
    print(h,n,g(n))

Clear version
            import math
            import sys

            def calcPoint(degHead, points):
                maxPoints=32
                if points not in(8,16,32):
                    sys.exit("not a good question")
                degHead=(degHead+(360/points/2))/(360/maxPoints)
                j =int(int( int(degHead  % 8)%8/(maxPoints/points))*maxPoints/points)
                degHead = int(degHead / 8) % 4
                cardinal = ['North', 'East', 'South', 'West']
                pointDesc = ['W', 'W by x', 'W-z', 'Z by w', 'Z', 'Z by x', 'X-z', 'X by w']#vars not compass points
                W = cardinal[degHead]
                X = cardinal[(degHead + 1) % 4]
                w=W.lower()
                x=X.lower()
                if (W == cardinal[0] or W == cardinal[2]) :
                    Z =W + x
                else:
                    Z =X + w
                z=Z.lower()
                return pointDesc[j].replace('W', W).replace('X', X).replace('w', w).replace('x', x).replace('Z', Z).replace('z', z);

            def getShortName(name):
                return name.replace('North', 'N').replace('East', 'E').replace('South', 'S').replace('West', 'W').replace('north', 'N').replace('east', 'E').replace('south', 'S').replace('west', 'W').replace('by', 'b').replace(' ', '').replace('-', '')

            def input_number(msg, err_msg=None):
                while True:
                    try:
                        return float(input(msg))
                    except ValueError:
                        sys.exit("not a number")

            while True:
                headingCalib=input_number("input a number: ")
                print (headingCalib, end=' ')
                name = calcPoint(headingCalib,32) #degrees heading, points of compass 8,16 or 32)
                print (name, end=' ')
                shortName = getShortName(name)
                print (shortName)

This answer shows no attempt at golfing and is therefore subject to deletion as  not a serious contender for the challenge

Fair point - I've posted the attempt at golfing now.

Why do you have so much indentation in your submission? It doesn't seem to part of your answer, so I don't see the point of it. You can also golf this a lot more, just by removing all the extra whitespace, shortening variable names and declarations, and removing redundant variables altogether

Thanks Jo, I've updated the version again.  Did I get it all?

reused a dictionary for cardinals much better.  Out of ideas now.  Hopefully enough to qualify?

Much shorter answer, simply by getting rid of unnecessary whitespace

... and removing a few redundancies/unnecessary operations

Thanks frank - quite right and educational.  So should I put that in the OP? not sure what the protocol is here.

You're still using a 2-space indent and you could go down to 1-space (or use tabs). I also get either 888 bytes or 806 bytes on tio, depending on whether or not I include or exclude the 2 spaces you have on every line (not 848).

Thanks. I think Monica and Frank knocked it out ofthe park so I will leave it there at -1. I tried.

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


text:
Turing-Complete polyglot
Write a polyglot (code that works in two or more languages) that has a "mid-section" that can be modified to do any computational task. This question is similar to https://stackoverflow.com/questions/1053931/code-golf-shortest-turing-complete-interpreter.
Rules:
The program must be able to preform a computation and print the results. Pseudorandom number capability is a plus but not necessary. The results must be the same in all languages, minor string-formatting differences are OK.
There is a section in the program that can be modified (in a straight-forward way) to do any computation (Turing complete). This is like the "comments section" in http://ideology.com.au/polyglot/polyglot.txt for which any comment can be inserted.
You must use at least 2 languages (this rule is here so you don't sue me).
Edit: Ideally you only need to write the "computation" part once. It is less interesting to use comment blocks, etc to knock out A so you have a block from B and then knockout B to write code from A. However, the one block solution is very difficult unless the languages have enough "overlap".
Also, using very similar languages (like C# and Java) isn't as interesting. It is still allowed but will probably earn less votes.
Grading
The winning is a popularity contest (Mar 1st).

What's your winning criterion?

Just made it a popularity contest, easy to do.

Why the 2 languages rule and how different do they have to be? Can we use C, C++, C# (and possibly Java)? (Would that be 4 languages?) ..... Ok as it's a popularity contest I guess the mob could decide that one, but I will make the point anyway.

Do python 2 and python 3 count as different languages?

Ruby and Spidermonkey JS
i=0
r=rand
=begin
=Math.random(); n=print;
var end=''; y
=end
//=~''; def n(x); puts x; end

while ((i+=1) < 5)
  if (i%2==0)
    n('Hi!')
  else
    n('Bye!')
  end;
end;

a=17*r
n(a);

This works because...

rand is random in Ruby, but a variable in JS that gets assigned to Math.random(). A slight improvement would be assigning JS's rand to Math.random so that you can execute rand() in both.
=begin...=end is a comment block in Ruby and assignment in JS
The middle part is polyglot.  If you gave the list of any functions you'd like, I'd def them in Ruby so they are the same as the JS ones or possibly define them in JS.
end, needed to end code blocks in ruby is now defined as '' in JS.
while is the same in both languages, as is +=, ==, -=, *, -, +, =, %, /, 'strings'
// is the start of a comment in JS but a regex in Ruby.
n is defined in Spidermonkey JS to be print (which outputs to stdout).  In Ruby, I redefined it to be puts, much the same.  If I weren't in a code-golf mindset, I would have def print(x) instead of n(x).
No use of polyglot comments!

"The middle math part is polyglot". Is there enough overlap in the languages for the middle part to be turing complete?

I missed that.  What are your requirements for completeness?  This is an incredibly undefined question.  We have */%-+(), and I can work on an if/else based on <,>,==. Is there anything else lacking?

"turing complete" is not ill defined. You would also need to have some sort of while/for loops in order to qualify.

@KevinKostlan Ok - got single-line while and if/else.  Is that sufficient?

If you can increment and decrement variables, and have at least two variables that store bignum integers available, while is sufficient. That's the simplest Turing Complete construction using the sort of primitives you have here.

C, Python, and Brainfuck
The Brainfuck program on the line starting with pgm= can be changed into any valid Brainfuck program (so it is Turing-complete). The program will then run in C, Python, and Brainfuck. The given program prints Hello World!.
The interpreters in both C and Python have the following characteristics:

8-bit cells
Infinite tape in both directions
-1 (255) on EOF

It runs like this:
$ gcc poly_bf.c; ./a.out
Hello World!
$ python poly_bf.c
Hello World!
$ bf poly_bf.c
Hello World!

And here's the program:
#define AA [
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define BB ]
#define PGM char*\
pgm="++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
#define ZZ \
""" [-][";
struct cell { char val; struct cell *prev; struct cell *next; };
struct cell *prv(struct cell *c) {
    if (!c->prev) {
        struct cell *z = malloc(sizeof(struct cell));
        z->next = c;
        z->prev = 0;
        z->val = 0;
        c->prev = z;
    }
    return c->prev;
}
struct cell *nxt(struct cell *c) {
    if (!c->next) {
        struct cell *z = malloc(sizeof(struct cell));
        z->prev = c;
        z->next = 0;
        z->val = 0;
        c->next = z;
    }
    return c->next;
}
int main() {
    PGM
    int ip=0, t=0;
    struct cell *c = malloc(sizeof(struct cell));
    memset(c, 0, sizeof(struct cell));
    while (pgm[ip]) {
       switch(pgm[ip]) {
           case '+': c->val++;break;
           case '-': c->val--;break;
           case '>': c=nxt(c);break;
           case '<': c=prv(c);break;
           case '.': putchar(c->val);break;
           case ',': c->val=getchar();break;
           case '[':
               if (c->val) break;
               ip++;
               t=1;
               while (t) {
                  t += pgm[ip] == '[';
                  t -= pgm[ip] == ']';
                  ip++;
               }
               ip--;
               break;
           case ']':
               if (!c->val) break;
               ip--;
               t=1;
               while (t) {
                  t -= pgm[ip] == '[';
                  t += pgm[ip] == ']';
                  ip--;
               }
               ip++;
               break;
       }
       ip++;
    }
    return 0;
}
#define YY \
" """;
#define XX /*
import sys;
ip=t=0
class Cell:
  pv=None
  nx=None
  val=0

  def prev(self):
     if not self.pv:
        self.pv = Cell()
        self.pv.nx = self
     return self.pv
  def next(self):
     if not self.nx:
        self.nx = Cell()
        self.nx.pv = self
     return self.nx

cell=Cell()
while ip<len(pgm):
  if pgm[ip]=='+': cell.val+=1;cell.val%=256
  elif pgm[ip]=='-': cell.val-=1;cell.val%=256
  elif pgm[ip]=='>': cell=cell.next()
  elif pgm[ip]=='<': cell=cell.prev()
  elif pgm[ip]=='.': sys.stdout.write(chr(cell.val))
  elif pgm[ip]==',':
      ch=sys.stdin.read(1)
      if ch:cell.val=ord(ch)
      else:cell.val=255
  elif pgm[ip]=='[' and not cell.val:
      t=1
      ip+=1
      while t:
        t += pgm[ip] == '['
        t -= pgm[ip] == ']'
        ip+=1
      ip-=1
  elif pgm[ip]==']' and cell.val:
      t=1
      ip-=1
      while t:
        t -= pgm[ip] == '['
        t += pgm[ip] == ']'
        ip-=1
      ip+=1
  ip+=1
#]*/

I really like this answer. You managed to write a bf interpreter polyglot. But wouldn't bf running this get confused by the <> characters in things like #include<stdio.h>?

@KevinKostlan: No, they're wrapped in braces, so they're skipped. (#define AA [)

Ruby and C
//; def void x; end; def main x, &b; b.call; end; def int x; end; arg = nil

//# Welcome to the Ruby/C polyglot thingy!
//# Simply insert whatever code you would like below.

void main(int arg) {

//; puts 1+1 # any Ruby code can be inserted on this line
//; puts 2+2 # the Ruby version is extendable to an arbitrary amount of lines
//; puts 3+3
//; puts 4+4

#define f printf(1+1) // any C code can be inserted on this line
//;f=nil
f;
#define g printf(2+2) // the C version is somewhat extendable
#define h printf(3+3)
#define i printf(4+4)
//;g=h=i=nil
g;h;i;

}

This takes advantage of the fact that

//# is a comment in both languages
//; is a comment in only C
"#define x " (with the space!) is (somewhat of) a comment in only Ruby

you then have to actually put it in the code, which is why I assign all the vars to nil and then simply place them in a new line

More extendable C version
//; def method_missing m, *args; end
#define a printf(1+1);
#define b printf(1+1);
#define c printf(1+1);
#define codegolf printf(1+1);
#define llama printf(1+1);
a b c codegolf llama

PHP, ASP and JS:
WARNING: THIS WAS NOT TESTED:
Here is an attempt:
<!--<?error_reporting(0);?><% WebService Language="JScript" Class="MyClass" %>-->
<script runat="server">
console.log('/*<?=#*/$a='Math';/*?>*///#?>');
</script>

What should happen:
It should run the Javascript code on the server, when running on ASP.
In php, should output absolutely only the Javascript part, Saying 'Math' inside the whole comments.
In Javascript, it should put all that "garbage" in the console.
If it is invalid, just comment and I will remove this answer.


text:
Random number generation, without built-in random number generation libraries
Task:
Make a random number generator. The catch is that you can't use any built-in randomness functions. Your random numbers must be anything between 0 and 100, though they do not have to be floating point.
Rules:

It must produce a pseudorandom number.
Randomness defined: If you run it x times, then x times again, the two sequences will be unlikely to be identical. Where 2 < x < 10.
It is not required that your random number generator passes any specific test about the quality of the generated numbers, as long as the previous rule is respected.
Any language is accepted, except Golfscript, see here.
This is code-golf, so the shortest answer in bytes wins.
You may not hard-code the output numbers or read them from a file.
Post 5 numbers generated by your program.
Good luck!

Because I was typing the moment you commented: -1 because of arbitrarily restricting the languages accepted.

I would recommend you give an objective definition of "random". Is pseudorandom enough? Or does it have to be true random? In the latter case, how do you test it? (E.g. Diehard tests? https://en.wikipedia.org/wiki/Diehard_tests )

Moreover it seems to be a duplicate (http://codegolf.stackexchange.com/q/10553/1490).

@ace there's no random generator. The only truly random one that you could have would be based probably on some quantum mechanics, but are you sure you're able to make the two measurements ortogonal? Anything software-based will be pseudo-random, since it's proved that for every PRG there exists a statistical tests that distinguishes it from a random sequence.

What about guids?

@Howard - first off, see the link next to the language restriction, and second of all, that question does not restrict the use of built-in functions

I know the link but that doesn't change my view that a question should not restrict the languages. And the other question reads Build a random number generator which clearly excludes built-in generators.

@microbian you mean the stuff where you shake your mouse? That doesn't fall into the "algorithmic PRG" category, that's true. However, nothing based on human action is quite considered random. (More a philosophical than mathematical question, let's rather avoid this discussion. However, as long as there's any pattern in the human's behaviour and any pattern in the receptors precision, it can be somehow measured.)

@tohecz what I'm trying to say is that this question is opinion-based as the definition of "random" is open to debate. Oh and TheDoctor, here's a quote from that question: "This function must not call upon any libraries or other functions that were not also written as part of the program, especially calls to /dev/random or a language's built-in rand() library. More specifically, you are limited to the basic operators of the language you are working in, such as arithmetic, array access, and conditional flow control statements."

@tohecz, actually my comment about guids was for the OP.  Totally agree with you.

@microbian ok good to know :)

This question does not requires that the random number generators passes any diehard tests, and without this requirement, it is possible to use a different strategy to golf it. Further, the output range is distinct. This way, an answer that was invalid in the old question could be the winner here. So, it does not seems to be a duplicate for me, even if it is a very similar question.

@Victor A major problem will be, how random is "random"? Without an objective way of defining it, this should be closed as "opinion-based", and with an objective way of defining it, in my opinion this would be a duplicate.

@TheDoctor. I suggest that you edit the question with something like this: "NOTE: The program is random enough if it is able to output different numbers when runned multiple times and may generate any integer number in the interval 0 to 100".

Did we get an answer on GUIDs? Does that count as "built-in randomness function"? (I lean toward yes, myself.)

@microbian - yes, you can use GUIDs

@Victor that's not true. Most pseudo-random generators included in language libraries are not "able to output different numbers when ran multiple times", unless you call a specific function, usually called Randomize(), passing it an external value.

@Tobia I know, but this is not the point. My suggestion was solely with the purpose of fixing the text in the question, not to define exactly what is or what is not a pseudo-random generator. The program when runned should be able to generate any number from 0 to 100. If you do have a better suggestion, drop it here.

-1 for forbidding golfscript, per my "tradition" of sorts of downvoting these sorts of restrictions.

@thedoctor If you're going to disallow GolfScript, disallow J and APL. I worked around it with mine in allowing the function declaration to not be counted. Nothing like seeing APL not too far ahead of the pack because String foo() is no longer counted.

@TheDoctor I edited your question to add a rule (and hopefully reopen your question). Tell me if you are ok with it.

@Victor - that seems somewhat contradictory to the bullet right above it. It would also open up a vulnerability to answers like return 4

@TheDoctor What about it now?

@Victor - yep that works. Now we need 1 more reopen vote...

That's a really rubbish (not to mention ambiguous) definition of random.

C (46)
The stack pointer is sort of a random number
main(x){printf("%d",((unsigned char)&x)%100);}

Numbers I got:
20
40
4
52
36

The question requires the numbers to be between 0 and 100. Also, please include the language and the character count in your answer. By the way, this can be golfed down a lot more. You can remove <stdio.h>, and remove the type definition of main. Here's a completely golfed down version: main(x){printf("%d",&x);}

Are these the rules of the game? I don't think the compiler will like that

tested on gcc and it works perfectly, as long as you ignore the warnings (warnings are not errors, and the program is still valid). In C, if no type is specified, the compiler assumes int. Also, by defining x as an argument of main, you save yourself a semicolon. I'm just trying to help though, if you don't want to change, it's perfectly fine with me, but please add your language to your answer!

No parens around (unsigned char)&x needed, (typecast) binds tighter than %

On my mac, this produces the same output with every run.

@blabla999 I guess there is some re-usage of the stack, for me works perfectly on windows

probably has to do with address randomization of new OSs

This can be golfed down further: abs(&x) can be used instead of the unsigned char typecast, and even if you want to do a typecast, an unsigned int will be shorter than an unsigned char. I'm just posting these tips hoping that they can be useful in your next code golf challenge :)

python, 49
x=7
def r(x):print(x%100);return(69069*x+1)%2**32

This is my first time golfing, I think this is within the rules but I'm not sure. This is a simple linear congruential generator, with starting x value as seed. User time is not used. To use, type x=r(x).
Here are the results:
7
84
25
62
47

Linux utils and ALSA, 41
Not a winner, but possibly a more accurate source of random noise than the current time:
arecord -qfS32|od -l -j48 -N8|cut -c27-28

Sample 5 random numbers:

32 53 81 83 26

Unless you have no ALSA...

@TheDoctor If you have no ALSA, you better update your kernel to a non-ancient version

Oh, i have ALSA

Java - 250 249 characters
import java.awt.*;class A{public static void main(String[]y)throws Exception{int z=200,u=z*z-1,n=7;java.awt.image.BufferedImage b=new Robot().createScreenCapture(new Rectangle(z,z));while(u>0)n^=b.getRGB(u/z,u--%z);System.out.println((n>>>1)%101);}}

It uses the topright 200x200 pixels of the screen as a source of randomness. The result is an integer between 0 and 100.
I runned it 5 times (this last version) and got this:
97
84
38
40
65

I had to move my windows around between each run.
Needless to say, it is a very poor random-generator:

It is frequently predictable.
It is easily stalled to keep giving always the same output.
It is unlikely to produce each number between 0 and 100 with an equal probability.

So, this should not be used by any serious purpose.

Java - 206 characters
class V{public static void main(String[]y)throws Exception{java.io.InputStream o=new java.net.URL("http://bit.ly/1gxstDI").openStream();int x,n=7;while((x=o.read())>0)n^=x;System.out.println((n>>>1)%101);}}

Similar to my previous answer. However, it is smaller and has some better randomness properties (but still bad). It fetches random data from http://en.wikipedia.org/wiki/Special:random as a seed (I am borrowing this idea from this answer).
Running it five times, here is the output:
25
15
93
32
9

An argument could be made that you are using a built in of some other language is issuing.

bash, 17
date +%N|tail -c3

Outputs the last two digits of a nanosecond timestamp.
Sample output
$ ./random
24
$ ./random
52
$ ./random
82
$ ./random
69
$ ./random
72

APL, 9 chars
101|+/⎕TS

Nothing new. It sums the components of the TimeStamp vector (current year, month… down to ms) and takes the remainder mod 101.

Python 2.7 - 82 bytes
import timeit
print timeit.Timer('for i in range(1000):i**i').timeit(1)*10000%100

This can definitely be golfed down more. I couldn't get timeit working when using from timeit import* but I think I only lost one character there. This is my first time using the module so I'm probably missing a lot of stuff that could save characters.
Times how long it takes in (seconds?) to calculate i**i for 0-999, multiplies that by 10000 and takes the modulus of 100 to get the result in the correct range.
Since this works off of hardware deviation rather than a pseudorandom formula like most programs do, you could even call this "more random" than random.random()*100. :)
(That last part probably isn't true, but until someone explains why I'll continue to believe it.)

Last part is not true at all on machines with single running process, or in environments especially made to emulate that situation.

Dang, I felt clever for almost a whole minute. :P

In most situations, using the runtime tickcount is quite a safe seed (similar to what you do), but certainly not in the system's kernel, since the risk of reoccurance of the same seed is more than high.

bash — 108 106 bytes
ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'

Gets a set of all three-digit triplets from a detailed listing, exclusive ORs them with each other, then prints a result modulus 101 to get [0, 100].
Depending on the activity in the directory, may be random-ish, or dynamic but predictable, but should never be static. Running it 1000 times, I was surprised that there didn't seem to be any patterns.
Sample output:
$ ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'
37
$ ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'
95
$ ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'
62
$ ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'
6
$ ls -al|tee -a X|grep -o [0-9]|xargs -n3|sed 's/ //g'|sort -u|awk 'BEGIN{X=0}{X=xor(X,$0)}END{print X%101}'
51

The question asks for 5 generated numbers. So run it one more time.

@Victor - done.

Use "sort -u" instead of "sort|uniq" to save 4 bytes

@GlennRanders-Pehrson - Thank you!

Perl, 17
Seems like predictability isn't so much of an issue here, so here's a simple one:
print time**3%101

Five outputs:
59
38
17
14
94

I hope this answer highlights the importance of objectively defining the question.

You could drop the **3 and shave 3 bytes off. It won't change the distribution or the predictability of your "RNG"

@Tobia I'm not really into the challenge, I just want to show by example that this question is really very poorly defined

Yes, well, depending on the circumstances, using the time of the day as a pseudo-random number can be perfectly acceptable. For example, to initialise Randomize() at the start of one's program. (Assuming an "attacker", for any definition of the term, cannot control the time of the day when your program is started or restarted.)

@Tobia I am aware of this usage. But at least those algorithms will be difficult to predict.

PowerShell (66)
[Convert]::ToInt32((""+([guid]::newguid())).SubString(0,2),16)%100

5 outputs:
10
92
13
84
0

Ruby, 69
def r()(Time.now.to_f.to_s+$$.to_s+$-I.join).bytes.reduce(:+)%100;end

Online Version for testing. Uses the current time in ms, the process id ($$) and the runtime environment ($-I) for creating a pseudo-random number.
Output:
47
44
39
43
88

Run it five times and post the output.

Java, 99 chars
class b{public static void main(String[]a){System.out.println(System.nanoTime()/a.hashCode()%99);}}

75
28
34
88
16

If you want to be really really cheap:
java 88 Chars
class b{public static void main(String[]a){System.out.println(System.nanoTime()/9%99);}}

99
86
61
15
19

Run each one five times and post the output.

Smalltalk, 39
not a production quality random generator:
OperatingSystem getMicrosecondTime\\101

but as I generated those 5 values by eval'ing them interactively, it's me who makes it random.
Output of 5 evaluations:
 93 28 25 6 25

PS: the free running us timer is normally used for profiling...
A much better random gen would be:
'/dev/random' asFilename readStream nextByte/2.55

The latter is only available on *nix systems, and is a built-in (not to Smalltalk, but the OS)

CMD / Batch - 14 Bytes
echo %time:~9%

Grabs milliseconds off the end of the variable %time%.
Add @ before the command to make it only output the number.
C:\>echo %time:~9%
40

C:\>echo %time:~9%
53

C:\>echo %time:~9%
19

C:\>echo %time:~9%
73

C:\>echo %time:~9%
25

Any output? Run it 5 times and post

@TheDoctor please see my updated answer.