text:
Sum of integers in string, separated by non-numericals such as 'a' and 'Y'
Create a program which sums all integers found in a string which is set as a variable in the program (thus, the program doesn't have to handle any input). The integer numbers are separated by non-numericals (anything but 0, 1, 2, 3, ..., 9).
Examples:

e7rde f  ,fe 43 jfj 54f4sD = 7+43+54+4=108
5 = 5
64 545,5445-32JIFk0ddk = 64+545+5445+32+0=6086
0ab0 = 0+0 = 0

Extra notes:

Unicode support is not necessary, but allowed
-n (where n is an integer) is not counted as a negative n, but as a hyphen followed by n.

The answer may be printed on the screen (but not required).
Shortest answer (in characters) win.

Should we print the result too? (You mention no I/O).

@Dogbert - I didn't think about that. Sorry, yes. I will update the post.

Changed it as some people already had answers and didn't want to "hurt" them. I guess I should sleep now, so I will think a bit clearer ;)

Anto: A task where a solution has no observable side-effects isn't very nice, though.

An interesting test case I just ran into would be 5a-3 (my code would skip - if it follows a number immediately, but not if there was a non-number before it).

Perl, 15
Input in $_, sum in $c:
s/\d+/$c+=$&/ge

Ruby 1.9, 21 characters
eval a.scan(/\d+/)*?+

To print the solution to stdout, 2 additional characters are required:
p eval a.scan(/\d+/)*?+

And to read from stdin instead of using a predefined variable, another 3 characters have to be used:
p eval gets.scan(/\d+/)*?+

For Ruby 1.8, replace ?+ with "+" to get a working solution in 22 characters.

The input is supposed to be taken from a variable, not stdin. Also scan is shorter than split. So your solution becomes eval s.scan(/\d+/)*?+ - 21 characters.

@sepp2k: Yeah, didn't read the description correctly. I'm just used to the other golf-tasks, where you usually have to read from stdin and print to stdout. Good point with scan, thanks!

+1, great use of eval and * '+'

Ruby - 36 34 chars
s.scan(/\d+/).map(&:to_i).reduce:+

36 chars if you want the result printed.
p s.scan(/\d+/).map(&:to_i).reduce:+

Assumes the input is present as a string in s.

Python (60)
import re;print sum(map(int,filter(len,re.split(r'\D',s))))

JavaScript (ES6), 30
c=0,s.replace(/\d+/g,d=>c+=+d)

Annotated version:
// Store the sum.
c=0,
// Process every number found in the `s`.
s.replace(/\d+/g,
  // Convert the number into an integer.
  // Add it to the sum.
  d => c += +d
)

Windows PowerShell, 23 25 29 31
With output.
$x-replace'\D','+0'|iex

In fact, without output is exactly the same, you'd just pipe it somewhere else where it's needed.

JavaScript [31 bytes]
eval(s.match(/\d+/g).join('+'))

I count it 31 bytes?

@l4m2 Yes, you are right, fixed.

I know this is really late but you can save 2 bytes by changing .join("+") into .join\+``

gs2, 4 bytes
W#Θd

Encoded in CP437; the third byte is E9.
W reads all numbers /-?\d+/ from a string, #Θ maps absolute value, d sums.
(gs2, too, is newer than this challenge, but its read-nums command is a total coincidence.)

J - 40 38 characters
Lazy version. Requires the string library.
+/".(,' ',.~a.-.'0123456789')charsub y

Supports Unicode. Supports encoding, come to think of it!

Java
out of the contest ;)
public static long sum(String s) {
    long sum = 0;
    String p = "";
    char[] ch = s.toCharArray();
    for (int i = 0; i < ch.length; i++) {
        boolean c = false;
        if (Character.isDigit(ch[i])) {
            if (i + 1 < ch.length) {
                if (Character.isDigit(ch[i + 1])) {
                    p += ch[i];
                    c = true;
                }
            }
            if (!c) {
                p += ch[i];
                sum += Integer.valueOf(p);
                p = "";
                c = false;
            }
        }
    }
    return sum;
}

Labyrinth, 29 21 bytes
(Disclaimer: Labyrinth is newer than this challenge.)
Also, Labyrinth doesn't have variables, so I went with a normal input/output program.
)_"+`
( "?"
";;,;;(!@

This was fairly simple because of the way Labyrinth's input commands work. ? tries to read a signed integer from STDIN and stops at the first non-digit. If it can't read an integer (because the next character is a - not followed by a digit, or any other non-digit, or we've reached EOF), it will return 0 instead. , on the other hand reads any subsequent byte and pushes the byte value. If this one is called at EOF it will return -1 instead.
So here's some pseudocode for the solution:
running total = 0
while(true)
  while(true)
    try reading a non-zero integer N with ?
    if(N < 0)
      running total -= N
    else if(N > 0)
      running total += N
    else
      break
  // We've either read a zero or hit a something that isn't a number
  try reading a character with ,
  if(that returned -1)
    break
print running total

Dealing with negative numbers correctly complicates this solution quite a lot. If it weren't for those, I'd have this 8-byte solution:
?+
;,;!@

Perl 5 -MList::Util=sum -pF/\D+/, 8 bytes
$_=sum@F

Try it online!

05AB1E (legacy), 5 bytes
.œþOà

Try it online or verify a few more test cases. (Times out for the larger test cases due to the .œ builtin.)
Explanation:
.œ     # Get all partitions of the (implicit) input-string,
       # which are all possible ways of dividing the input-strings into substrings
  þ    # Only leave the items consisting of digits for each partition
       # (in the new version of 05AB1E, an explicit `€` is required)
   O   # Sum each inner list
    à  # Pop and push its maximum
       # (after which the result is output implicitly)

Bash + GNU utilities, 24 bytes
dc<<<`tr -c 0-9 +<<<$s`p

Try it online!
Input in the variable s, output on stdout.

Pip, 7 bytes
$+a@+XD

Try it online!
Regexes all numbers to a list and sums them.
+1 byte fix from DLosc.

Are you sure? If the third testcase counted minuses it'd be 6022, not 6086

ah yes trivial modification time!

Vyxal s, 6 bytes
`\D`ṡ⌊

Try it Online!
Ugh we really need to make ⌊ play nice with strings not containing numbers in v2.6; this would be 6 bytes if it didn't error. 2.6 done did make the change lol.
Explained
`\D`ṡ⌊
`\D`   # The string "\D" (a regex that looks for non-digits)
    ṡ  # Split the input on this regex
     ⌊ # Convert each to a number
       # Output the sum with the `s` flag

5

Perl, 16 chars
s/\d+/$r+=$&/ge;

Takes input in $_, output goes on $r. Last semicolon is superfluous, but it will probably be needed when the program does more things. Add say$r for output.

Oops, didn't see your exact same answer when I posted.  Though I counted one character more even without the semicolon.

@J B: I can't count! :P. Actually, I made the mistake of echo'ing a double quoted string to wc -c.

PHP - 37
Without printing;
<?array_sum(@split("[^0-9]+",`cat`));

With printing (38):
<?=array_sum(@split("[^0-9]+",`cat`));

R, 30
sum(scan(t=gsub("\\D"," ",x)))

Here, x is the name of the variable.
Example:
> x  <- "e7rde f ,fe 43 jfj 54f4sD"
> sum(scan(t=gsub("\\D"," ",x)))
Read 4 items
[1] 108

J - 23 char
Not a winner, but we get to see a fairly rare primitive in action.
+/".(,_=_"."0 y)}y,:' '

Explained:

_"."0 y - For each character in the input string y, try to read it in as a number. If you can't, use the default value _ (infinity) instead.
,_= - Check each result for equality to _, and then run the final array of 0s and 1s into a vector. ("."0 always adds one too many dimensions to the result, so we correct for that here.)
y,:' ' - Add a row of spaces beneath the input string.
} - Used as it is here, } is called Item Amend, and it uses the list of 0s and 1s on the left as indices to select the row to draw from in the right argument. So what happens is, for each column in the right side, we take the original character if it could be read in as a number, and otherwise we take the space beneath it. Hence, we cover up any non-numeric characters with spaces.
+/". - Now convert this entire string into an list of numbers, and sum them.

C 96
Thanks to @ceilingcat for some very nice pieces of golfing - now even shorter
t;main(i,v)int**v;{for(char*q,*s=v[1];*s;q>s?t+=abs(i),s=q:s++)i=strtol(s,&q,0);printf("%d",t);}

Try it online!
An earlier 85 byte version that is cheating a bit by hardcoding the string inside the program:
t=0;main(i){for(char*q,*s;i=strtol(s,&q,0),*s;q>s?t+=abs(i),s=q:s++);printf("%d",t);}

To actually use the 85 byte program you need to assign the variable like so:
t=0;main(i){for(char*q,*s="text";i=strtol(s,&q,0),*s;q>s?t+=abs(i),s=q:s++);printf("%d",t);}

Actually, 14 bytes
9u▀8╙r♂┌-@s♂≈Σ

Try it online!
This program supports the CP437 code page for input.
Explanation:
9u▀8╙r♂┌-@s♂≈Σ
9u▀             base 10 digits (0-9)
   8╙r♂┌        all characters in CP437 (map(ord_cp437, range(2**8)))
        -       set difference
         @s     split input on any value in the resulting list
           ♂≈Σ  convert to ints and sum

Brachylog, 9 bytes
{~cịˢ+}ᶠ⌉

Try it online!
It's... inefficient... so I've neglected to test the longer cases. It appears to work, though. Takes input through the input variable, which just so happens to be the usual form of input anyhow.
        ⌉    The output is the largest
{     }ᶠ     possible
     +       sum of
   ịˢ        integers the string representations of which are some elements of
 ~c          a partition of the input.

⌉ ensures that numbers are maximally matched as well as never negative, since splitting a number up, invalidating a number, or turning it negative will never result in a larger sum.

K4, 21 14 bytes
Solution:
+/. .Q.n .Q.n?

Explanation:
With thanks to @cillianreilly - I didn't expect a string of numbers to be tokenised with value.
+/. .Q.n .Q.n? / the solution
         .Q.n? / lookup right in the string "0123456789"
    .Q.n       / index back into "0123456789"
  .            / 'value', tokenises string into integers
+/             / sum up

You can use . (value) instead of "J"$" "\: to convert to integers before summing. Saves 7 bytes. +/. .Q.n .Q.n?

Stax, 8 bytes
µÖ▀o)♫⌐ƒ

Run and debug it
Finds all substrings matching \d+, then eval and sum.

Funky, 38 bytes
s=>{n=0forv ins::gmatch"\\d+"n-=-v[0]}

Explained
s=>{                                 } $# A function taking argument "s"
    n=0                                $# Preset n to 0
              s::gmatch"\\d+"          $# An iterator function which finds all groups of digits in a string
       forv in                         $# Iterate through, setting v to the match
                             n-=       $# Subtract n by
                                -v[0]  $# The negative of the whole match, which implicitely numberfies it.
                                       $# Conveniently implcit return from last statement in the function.

Try it online!

Japt v2.0a0 -x, 3 bytes
q\D

Try it

Husk, 4 bytes
ṁiġ√

Try it online!
Explanation
ṁiġ√
  ġ√ group on isalpha
ṁ    sum
 i   the first integer in each string

Ruby -n, 26 bytes
p eval"#$_ 0".gsub /\D/,?+

Attempt This Online!
Appends  0 to the input, replaces each non-digit with +, then evals.

Retina 0.8.2, 12 bytes
S`\D
.+
$*
.

Try it online.
Explanation:
Split on non-digit characters, putting each number on its own separated line:
S`\D

Convert each number to unary, and implicitly remove the newlines:
.+
$*

Convert it from unary back to an integer, which is output implicitly as result:
.

Javascript - 43 chars
I know it's long, but there was no JS solution so :)
c=0
a=a.split(/[^\d]/g)
for(i in a)c+=+a[i]

ais the string. c contains answer.

Tcl, 30
expr [regsub -all \\D+ $a.0 +]

It assumes that the input is in the variable $a (formally, in a) and stores the answer in the interpreter result. I/O is left as an exercise.

Smalltalk (Smalltalk/X) (51 chars)
using the regex pakage:
(s regex:'\d+' matchesCollect:[:n|n asNumber])sum

w.o. regex:
((s asCollectionOfSubCollectionsSeparatedByAnyForWhich:[:c|c isDigit not]) map:#asNumber)sum

input in s

APL, 16 bytes
{+/⍎b\⍵/⍨b←⍵∊⎕d}

⎕d is a built-in containing the digits (0-9). b is assigned to a vector of 0/1 where 1 is given to the characters that are digits. b is used to compress the given character array and then reused to expand it, which inserts blanks. ⍎ is APL's eval which converts a string into a vector a integers, in this case. +/ computes the sum.

Equal length, but interesting: +/2⊃⍞⎕VFI⍨⎕AV~⎕D

Swift 3, 78
s.characters.split{!("0"..."9"~=$0)}.flatMap{Int(String($0))}.reduce(0){$0+$1}

where s is the string

Perl - 24 chars
warn eval join'+',/\d+/g

Input is in $_

SNOBOL4 (CSNOBOL4), 76 bytes
	I =INPUT
S	I SPAN(&DIGITS) . X REM . I	:F(O)
	O =O + X	:(S)
O	OUTPUT =O
END

Try it online!

Arturo, 29 bytes
$=>[match&{/\d+}do~"∑|<=|"]

Try it
$=>[             ; a function
    match&{/\d+} ; get the numbers in the input as a block of strings; push to stack
    do           ; eval
    ~            ; interpolate
    "∑|<=|"      ; sum TOS
]                ; end function

Thunno, \$ 9 \log_{256}(96) \approx \$ 7.41 bytes
"\d+"AfiS

Attempt This Online!
or verify all test cases
Explanation
"\d+"AfiS  # Implicit input
"\d+"Af    # Regex findall "\d+"
       i   # Convert to integers
        S  # Sum

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


text:
Calculate the last digits of Graham's Number
Graham's number ends in a 7. It is a massive number, in theory requiring more information to store than the size of the universe itself. However it is possible to calculate the last few digits of Graham's number.
The last few digits are:
02425950695064738395657479136519351798334535362521
43003540126026771622672160419810652263169355188780
38814483140652526168785095552646051071172000997092
91249544378887496062882911725063001303622934916080
25459461494578871427832350829242102091825896753560
43086993801689249889268099510169055919951195027887
17830837018340236474548882222161573228010132974509
27344594504343300901096928025352751833289884461508
94042482650181938515625357963996189939679054966380
03222348723967018485186439059104575627262464195387

Your program may not contain these (or similar numbers), but must calculate them. It must calculate 200 digits or more.
Output to stdout. Running time of a maximum of 2 minutes on decent hardware. Shortest program wins.

How many digits should be print?

@Dogbert D'oh. I missed that. 200 or more would be fine.

Ruby won't even calculate 3**7625597484987 whereas Python does :)

@gnibbler, umm how? the result would have more than 3 trillion digits.

@Dogbert, given enough memory and time Python will go ahead an calculate it using it's longs. Ruby won't even do 3**5000000. seems to have some sort of limit in there

dc - 21 chars
[3z202>xO200^|]dsxxrp

This takes about a minute on my computer, and would take lots longer for values larger than 200. It doesn't output leading zeroes.
Here's a slightly longer but faster version (26 chars):
[3rAz^|dz205>x]dsxxAz6-^%p
3[3rAz^|dz202>x]dsxxAz3-^%p # or an extra character for a few less iterations

Haskell, 99
Performance not stellar, but it manages to compute 500 digits in a minute on my decade-old hardware.
f a b|b==0=1|odd b=mod(a*f a(b-1))m|0<1=f(mod(a^2)m)$div b 2
main=print$iterate(f 3)3!!500
m=10^500

(btw, I'd love to hear about its performance on more modern hardware)

Takes about 19 seconds to run on my PC. On a side note, this doesn't print a leading 0 before the output.

Yup, it's buggy on all digit counts with leading zeros. Just compute for 501 ;-) Thanks for the benchmark.  Did you run it interpreted or compiled?

I compiled it with ghc -o g.exe g.hs. Not sure if that's the best way to compile.

I just ran ghc -O3 graham.hs  The recommended badass options from the online doc seem to be -O2 -fvia-C.  (and it looks like my GHC is a few releases behind already)

It seems to be running at the same speed with both -O3 and -O2 -fvia-C, in around 18.3 seconds.

Python - 62 59 55 chars
x=3
for i in range(500):x=pow(3,x,10**500)
print"0%d"%x

Takes around 12 seconds on my PC.
sh-3.1$ time python cg_graham.py
02425950695064738395657479136519351798334535362521430035401260267716226721604198
10652263169355188780388144831406525261687850955526460510711720009970929124954437
88874960628829117250630013036229349160802545946149457887142783235082924210209182
58967535604308699380168924988926809951016905591995119502788717830837018340236474
54888222216157322801013297450927344594504343300901096928025352751833289884461508
94042482650181938515625357963996189939679054966380032223487239670184851864390591
04575627262464195387

real    0m11.807s
user    0m0.000s
sys     0m0.015s
sh-3.1$

Native powmod is a killer :-)

You can use 10**500

@J B, that's the only reason I used Python for this entry :)

@gnibbler, updated, thanks! I'm new to Python :)

Python - 41 chars
499 digits
x=3;exec'x=pow(3,x,10**500);'*500;print x

500 digits
x=3;exec'x=pow(3,x,10**500);'*500;print'0'+`x`

You are using the knowledge that the 500th digit from the back is a 0. It would give the wrong answer for, say, 200.

@Tim The problem asks for "200 digits or more".  Just hardcode a count that works and be done with it. (or leave it as such: it prints 499 digits and that's good enough for the question as asked)

@J B: Sure, I'd be satisfied with the 499 if the 0 was left out. Now, however, it assumes that a specific digit is 0.

@user475 - By the properties of power-towers, if you are calculating the last (d) digits, and the result is less than (d) digits, then the missing digits (on the left) must be "0's". So it's OK to add the missing "0" digit, but it should be done by examining the length of the result and adding the appropriate number of "0's".

Axiom, 63 bytes
f()==(r:=3;d:=10^203;for i in 1..203 repeat r:=powmod(3,r,d);r)

ungolf and result
--This find the Graham's number follow the algo found in wiki
--http://en.wikipedia.org/wiki/Graham%27s_number
ff()==
   r:=3; d:=10^203
   for i in 1..203 repeat r:=powmod(3,r,d)
   r

(3) -> a:=f()::String
   (3)
  "8871783083701834023647454888222216157322801013297450927344594504343300901096
  92802535275183328988446150894042482650181938515625357963996189939679054966380
  03222348723967018485186439059104575627262464195387"
                                                             Type: String
(4) -> #a
   (4)  203
                                                    Type: PositiveInteger

#a=203 means the number len is >200 it menas too that it not has some 0 first...

Headsecks, 602 bytes
(h@HP0&Y+h8h (hx0RWc@4vYcx#@#PJ"B?[#CPx (h Lx$2(pl2YL;KD:T{9$2j<
 LSSh,ZT l2I<Pp,@4SX`,:xtc@T",($)<cKT\lbBAy44,dQl[yL"l+i,;9<*j0P
|)lD[+`\RBi!< LaD(LHPLyt{{@\iADRQdHTZQIT3[X`DB*`X$Cxh$*(T0$| ,[;
4:bit0DqAqi!lCYQ)<Ad(|1<$R4l+#tZrLPDatC[d*@0pDclJbh0|#S9<JRy!TP0
D+!|qiTXp<r$##Atj,B1ts;HLJ"Xp44I4cK4@|Q,4JI$|hp$Zyd+yl:y<s#\pD:9
4RDK,A!<X \cqLZ" h,kHp|qLRQIDh,+StZbL+{(|jqqL;9L"(xd"<s$8\:x,CY\
z0T[,(XdcxlbaD*D;+tDj\JIi4k[)LPDLBzP@DSc$jL $s4BjQ19|;!)|9t;TaQA
dLzit[0@l2!)I$,0P@$y<L4pLPLStQT"!a| $+8(DZ`00t ,RtX4C@$yQ11|KI\"
`|2<k3|R(Dyi<)LshTrzQ$sp D+DRbH|Q$CqT0D;AA\jdXd"ppdK3LzZl#\Bl`@t
k$*,11qTK+Xp|rqDZXp4{C!<Y4

Prints the last 200 digits.
Please remove the newlines before running.

How are we supposed to run it?

Absolutely no idea (I just translated this from BF). But I searched "headsecks" on github and it looks like there are a few implementations (though the reference implementation link seems to be dead).

source: Stack Exchange

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

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

sort: votes


text:
Finish a symmetrical map
You are given one-quarter of a map that is symmetrical over the x- and y-axes as input. The program should print the complete map.
The map can contain the following characters: -+/\|., and they should be turned as expected. The in data is always rectangular and small.
Example
$ cat in
+---
|./.
|/..

$ ./solution < in
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+

Shortest code wins.

What exactly does small mean for the input data? That's a bit vague to quantify.

@Joey Let's say the input is at most 16 rows and 40 characters.

I realised that I put no time limit, but if someone needs more than a second for his solution, I'd really like to see it.

Golfscript - 32 chars
n%{{.-1%{.3%2=115*^}%+}%zip}2*n*

Due to the symmetry of the problem, we repeat twice {flip horizontally, transpose (zip)}. As a bonus, you can change the value 2 to a larger number to repeat the image more.
Character transposition is done as x^=155 if x%3==2, due to the restricted character space. There's also {.5^3%(45+} at the same length.

Canvas, 5 4 bytes
║Ｑ↷↷

First Canvas answer, so let's start with an easy one. :)
-1 byte thanks to @dzaima.
The slashes are automatically converted when mirroring or rotating in Canvas.
Could have been 1 byte ╬ (Try it online), but unfortunately it also transforms the dots . to single quotes ' when mirroring horizontally.
Try it online.
Explanation:
         # (Take the multi-line input implicitly as canvas object)
║        # Palindromize the canvas object (without overlap)
 Ｑ      # Output it with a trailing newline (without popping)
  ↷↷    # Rotated the canvas object that's still on the stack by 90 degrees twice
         # (and output it implicitly as well at the end)

Windows PowerShell, 99 103 117 126 129
filter x{$_-split'/'-replace'\\','/'-join'\'}$input|%{$_+-join($_[40..0]|x)}|%{$_
$s=,($_|x)+$s}
$s

Notes:

This unfortunately needs two things that PowerShell is notoriously bad at while golfing: Reversing a string (or sequence of values) and transliterating stuff in a string. I'm fairly sure that this is at least twice as long as a Perl of Ruby solution.

Test:
> gc in| .\map.ps1
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+

> gc in2
+\/
/\/
> gc in2| .\map.ps1
+\/\/+
/\/\/\
\/\/\/
+/\/\+

History

2011-02-09 11:10 (129) – First attempt.
2011-02-09 11:27 (126) – OFS to save the -join and stored 99..0 in a variable.
2011-02-09 11:31 (117) – -replace works against arrays, so I don't need three -replaces but can do a -split, -replace, -join instead.
2011-02-09 15:03 (105) – Instead of doing the same thing twice, do it once and reverse it. And putting an assignment into parentheses causes it to spit out its value to the pipeline :-)
2011-02-09 15:08 (103) – I don't need $a anymore since 99..0 isn't used that often by now.
2011-02-09 15:17   (99) – There doesn't need to be whitespace after the filter definition. Removed $x and instead collecting every line during the first run in an array and then outputting that for the second half.

Ruby - 88 87 chars
t=->s{s.tr'/\\\\','\\\\/'}
puts a=$<.map{|l|l.chop!+t[l.reverse]}
puts a.reverse.map &t

Test Run
D:\tmp>ruby cg_sym_map.rb < sym_map.in.
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+

Nice, I like the puts-assignment.

Ah, there's my demise ;-) I knew it would come eventually

Charcoal, 5 4 bytes
Ｓ‖Ｍ⌈

-1 byte thanks to @Neil.
Charcoal automatically handles reflecting the slashes correctly.
Try it online (verbose) or Try it online (pure).
Explanation:
Take the input as a string:
InputString()
Ｓ

Reflect mirror it both towards the right and downwards (:⌈ is a builtin for :Right, :Down):
ReflectMirror(:⌈)
‖Ｍ⌈

@ASCII-only has since added some more multidirectionals including ⌈ which gives you right and down in a single byte.

@Neil How do you use ⌈ in the Verbose code? :RightDown will of course not be the result we'd want.

Multidirectionals just take a : prefix in Verbose mode.

@Neil So :Right:Down, or ::RightDown, or something else? Neither of these two results will give a ⌈ in the encoded version with the -vl argument, though. What would the verbose code have to become to get Ｓ‖Ｍ⌈ when using the -vl arg?

ReflectMirror(:⌈)

@Neil Ah, I'm an idiot.. lol. Similar as :^ or :* of course. Thanks.

(Actually ⌈ means :Right, :Down rather than :Down, Right. Only makes a difference for some operations such as Polygon.)

APL (Dyalog Classic), 25 23 22 21 19 bytes
(⌽⍪⊖){⊃3⌽⍵∪'/\'}¨,⌽

Try it online!

Perl, 80 chars
print reverse map{s@.*@($b=$&)=~y:/\\:\\/:,$&.reverse$b@e;print;y@/\\@\\/@;$_}<>

Shell Scripting!!
#!/bin/sh

rm temp
touch temp
file=$1
for STRING in `cat $1`
do
   printf $STRING >> temp
   for ((COUNT=0; COUNT<${#STRING}; COUNT++))
   do
      RECORD[$COUNT]=${STRING:$COUNT:1}
   done
   for ((REV_COUNT=${#STRING}; REV_COUNT>=0; REV_COUNT--))
      do
        if [ "${RECORD[$REV_COUNT]}" = "\\" ]; then
            printf "/" >> temp
        elif [ "${RECORD[$REV_COUNT]}" = "/" ]; then
            printf "\\" >> temp
        else
           printf "${RECORD[$REV_COUNT]}" >> temp
        fi
      done
   echo >> temp
done
cat temp
tac temp > temp2
for STRING in `cat temp2`
do
   for ((COUNT=0; COUNT<${#STRING}; COUNT++))
   do
      RECORD[$COUNT]=${STRING:$COUNT:1}
   if [ "${RECORD[$COUNT]}" = "\\" ]; then
            printf "/"
   elif [ "${RECORD[$COUNT]}" = "/" ]; then
            printf "\\"
   else
           printf "${RECORD[$COUNT]}"
   fi
   done
echo
done

I/O
./solution in

+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+

CJam, 26 bytes
CJam is newer than this challenge, so this answer is not eligible for the green checkmark, but it was a fun exercise anyway
qN/{{_W%"\/"_W%er+}%z}2*N*

Test it here.
Explanation
qN/{{_W%"\/"_W%er+}%z}2*N*
qN/                        "Read STDIN and split on newlines.";
   {                 }2*   "Execute this block twice.";
    {             }%       "Map this block onto each line.";
     _W%                   "Duplicate and reverse.";
        "\/"               "Push the string '\/'.";
            _W%            "Duplicate and reverse.";
               er          "Character transliteration, swaps slashes and backslashes.";
                 +         "Append to first half of the line.";
                    z      "Zip, i.e. transpose the map.";
                        N* "Join with newlines.";

The transposing at the end leads the the second flipping to be performed along the columns. At the end we transpose the map again, so we end up with the original orientation.

Powershell, 95 bytes
Inspired by Joey's answer.
filter x{$_;$_[40..0]|%{$_-split'/'-replace'\\','/'-join'\'}},($args|%{-join(,($_|% t*y)|x)})|x

Note: 40 because the author posts the comment Let's say the input is at most 16 rows and 40 characters.
Test script:
$f = {

filter x{$_;$_[40..0]|%{$_-split'/'-replace'\\','/'-join'\'}}
,($args|%{-join(,($_|% t*y)|x)})|x

}

@(
    ,( ("+---",
        "|./.",
        "|/.."),
        "+------+",
        "|./..\.|",
        "|/....\|",
        "|\..../|",
        "|.\../.|",
        "+------+")
    ,( ("+\/",
        "/\/"),
        "+\/\/+",
        "/\/\/\",
        "\/\/\/",
        "+/\/\+")
    ,( ("+---",
        "|...",
        "|..\"),
        "+------+",
        "|......|",
        "|..\/..|",
        "|../\..|",
        "|......|",
        "+------+")
) | % {
    $m,$expected = $_
    $result = &$f @m
    "$result"-eq"$expected"
    $result
}

Output:
True
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+
True
+\/\/+
/\/\/\
\/\/\/
+/\/\+
True
+------+
|......|
|..\/..|
|../\..|
|......|
+------+

Vyxal, 5 bytes
øṀ¶+∞

Try it Online!
øṀ    # Vertically mirror, flipping /\
  ¶+  # Append a newline
    ∞ # Palindromise

Ruby - 105
t=->s{s.tr '/\\\\','\\\\/'}
$<.read.split.map{|l|print l+=t[l.reverse]+"
"
l}.reverse.map{|l|print t[l]}

Golfscript - 44 chars
n%{.-1%'/'/{'\\'/'/'*}%'\\'*+}%.-1%{-1%}%+n*

result
$ cat in2
+-/|/\
/\|//-
$ cat in2 | golfscript codegolf-761.gs
+-/|/\/\|\-+
/\|//--\\|/\
\/|\\--//|\/
+-\|\/\/|/-+

Another script that only work for example and does not flip for '\' - 32 chars
n%{.-1%'/'/'\\'*+}%.-1%{-1%}%+n*

result
$ cat in
+---
|./.
|/..
$ cat in | golfscript codegolf-761.gs
+------+
|./..\.|
|/....\|
|\..../|
|.\../.|
+------+
$

\\ needs to be flipped as well.

@Nabb, thanks, that made my code huge :P

Mark: Use variables for repeated strings if it makes it shorter. Although there are a few other tricks that you can try to figure out before I post my answer later.

@Nabb, Thanks, I will try to figure out and let me have 30 minutes :D

@Nabb, I still couldn't figure out, you may post yours.

Haskell, 76 bytes
c '/'='\\';c '\\'='/';c x=x;i=(c<$>)
q#x=x++q(reverse x)
f=((i<$>)#).map(i#)

Try it online!
-- Only / and \ get converted, all other chars are passed as is
c '/'='\\';c '\\'='/';c x=x

-- "Invert" the string (that is switch all / and \ in it)
-- Just map our conversion function over the string
i = (c<$>)

-- Helper: Concatenate a list with its reversed copy (with the given function applied to the copy)
q # x = x ++ q (reverse x)

-- the resulting function:
f = ((i<$>)#) . -- produce the lower half of the image by reversing the upper half and inverting slashes in each line
    map (i#) -- produce the upper half or the image (by concating each input line with its reversed, inverted version)

MS-SQL 2017, 243 bytes
input:

DECLARE @s VARCHAR(100) ='+---'+CHAR(10)+'|...'+CHAR(10)+'|..\';

compressed:
declare @t TABLE(l INT IDENTITY(1,1),s CHAR(40));INSERT INTO @t(s)SELECT value+TRANSLATE(REVERSE(value),'\/','/\')FROM STRING_SPLIT(@s,char(10));SELECT s FROM(SELECT l,s FROM @t UNION ALL SELECT 1e3-l,TRANSLATE(s,'\/','/\')FROM @t)b ORDER BY l

human readable:

declare @t TABLE(l INT IDENTITY(1,1),s CHAR(40));
INSERT INTO @t(s)
  SELECT value+TRANSLATE(REVERSE(value), '\/', '/\')
  FROM STRING_SPLIT(@s,char(10));

SELECT s
FROM(
   SELECT l, s FROM @t
   UNION ALL
   SELECT 1e3-l, TRANSLATE(s, '\/', '/\') FROM @t
  )b
ORDER BY l

output (as text in ex.management studio):

+------+
|......|
|..\/..|
|../\..|
|......|
+------+

(6 rows affected)

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

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


text:
Print NxN spiral of ascending numbers
The numbers should be printed with leading zeroes in a field with length = (number of digits of N^2).
Input (N):
4

Output:
01 12 11 10
02 13 16 09
03 14 15 08
04 05 06 07

I am interested in the algorithm and the cleanliness of the implementation.
So, the white space does not count and the upper limit for N is 42.

yes according to me.

According to my calculations, the length of field is L = floor(log10(N^2)) + 1
Is this correct?

What's the upper limit on N?

I am interested in the algorithm and the cleanliness of the implementation. So, let's don't bother with very big numbers and set the upper limit of N to 42 :)

Was this motivated by the Ulam Spiral? (although your spiral is descending if viewed as starting on the inside)

@smci no, it was an interesting programming exercise I saw in a book

Oh. I thought the 42 in the spiral was telltale because of the well-known prime generator formula, which is what Ulam's Spiral is about.

42 is from The Hitchhiker's Guide to the Galaxy :)

Python
n=input()

matrix=[[j+1]*n for j in range(n)]

x=y=0
for i in range(n)[::-2]:
    x+=i*4;y+=1

    for j in range(i):
        matrix[j+y-1][y]=x+j

    matrix[y-1][y:y+i]=range(x,x-i,-1)

    R=matrix[n-y][y-1]+1
    matrix[n-y][y:n-y+1]=range(R,R+i)

    for j in range(y,y+i-1):
        matrix[j][n-y]=matrix[j-1][n-y]-1

for row in matrix:
    print ' '.join(`r`.zfill(len(`n*n`)) for r in row)

An approach that precalculate corner numbers. Eg, for 9x box, 32 56 72 80, which is (n-1)*4 where n is box sizes (9,7,5,3) in this case.
Right side of those numbers are 1-, and top to bottom is 1+, so basically generate from left to right, top to bottom, bottom to right, right to top side.

$ echo 9 | python codegolf-769-me.py
01 32 31 30 29 28 27 26 25
02 33 56 55 54 53 52 51 24
03 34 57 72 71 70 69 50 23
04 35 58 73 80 79 68 49 22
05 36 59 74 81 78 67 48 21
06 37 60 75 76 77 66 47 20
07 38 61 62 63 64 65 46 19
08 39 40 41 42 43 44 45 18
09 10 11 12 13 14 15 16 17

Other tests
$ echo 2 | python codegolf-769-me.py
1 4
2 3

$ echo 5 | python codegolf-769-me.py
01 16 15 14 13
02 17 24 23 12
03 18 25 22 11
04 19 20 21 10
05 06 07 08 09

$ echo 10 | python codegolf-769-me.py
001 036 035 034 033 032 031 030 029 028
002 037 064 063 062 061 060 059 058 027
003 038 065 084 083 082 081 080 057 026
004 039 066 085 096 095 094 079 056 025
005 040 067 086 097 100 093 078 055 024
006 041 068 087 098 099 092 077 054 023
007 042 069 088 089 090 091 076 053 022
008 043 070 071 072 073 074 075 052 021
009 044 045 046 047 048 049 050 051 020
010 011 012 013 014 015 016 017 018 019

In Ruby:
N=gets.to_i

index = -N
width = N
result = []
n = 0
dir=-1

while n < N*N
        dir = (dir + 1) % 4
        dir_x, dir_y = [[0,1],[1,0],[0,-1],[-1,0]][dir]
        width -= 1 if [1,3].include?(dir)

        1.upto(width) { |m|
                n += 1
                index += dir_y * N + dir_x
                result[index] = n
        }
end

width = (N*N).to_s.size
result.each_slice(N) { |l|
        print l.map {|n| "%0#{width}d" % n }.join(" "), "\n"
}

Test:
$ ruby1.9 769.rb <<< 9
01 32 31 30 29 28 27 26 25
02 33 56 55 54 53 52 51 24
03 34 57 72 71 70 69 50 23
04 35 58 73 80 79 68 49 22
05 36 59 74 81 78 67 48 21
06 37 60 75 76 77 66 47 20
07 38 61 62 63 64 65 46 19
08 39 40 41 42 43 44 45 18
09 10 11 12 13 14 15 16 17

An other solution using calculations from here :
N=gets.to_i
r=[]

tr=->x,y{ x+(N-1)/2 + (y+(N-1)/2+(N-1)%2)*N }

r[tr[0,0]] = N*N

1.upto(N*N-1) { |n|
        shell = ((Math.sqrt(n)+1)/2).to_i
        leg = (n-(2*shell-1)**2)/(2*shell)
        element = (n-(2*shell-1)**2)-2*shell*leg-shell+1
        x,y = [[element,-shell],[shell,element],[-element,shell],[-shell,-element]][leg]
        r[tr[x,y]] = N*N-n
}

r.each_slice(N) {|l|
        puts l.map { |n|
                "%0#{(N*N).to_s.size}d" % (n or 0)
        }.join(" ")
}

Test:
$ ruby1.9 769-2.rb <<< 5
01 16 15 14 13
02 17 24 23 12
03 18 25 22 11
04 19 20 21 10
05 06 07 08 09

In Python3:
n=int(input())
results = {}
val = 1
location = (0,0)
direction = (0,1)

def nxt():
    return (location[0]+direction[0], location[1]+direction[1])

while val<=n*n:
    if set([-1,n]).intersection(nxt()) or nxt() in results:
        direction = (direction[1],direction[0]*-1)

    results[location], location, val = str(val), nxt(), val+1

slen = len(str(n*n))
for y in range(n):
    print( *[results[(x,y)].rjust(slen,'0') for x in range(n)] )

Sample Output for 7:
01 24 23 22 21 20 19
02 25 40 39 38 37 18
03 26 41 48 47 36 17
04 27 42 49 46 35 16
05 28 43 44 45 34 15
06 29 30 31 32 33 14
07 08 09 10 11 12 13

edit: A recursive solution - 263 Bytes
def a(m,s):
 b,r,t=m-s*s+1,s-1,range
 return[[[]],[[m]]][s]if s<2 else[[b]+list(t(b+4*r-1,b+3*r-1,-1))]+[[b+y+1]+a(m,s-2)[y]+[b+3*r-y-1]for y in t(s-2)]+[list(t(b+r,b+2*r+1))]
n=int(input())
for r in a(n*n,n):
 print(*[str(x).zfill(len(str(n*n)))for x in r])

Nice solution, I've checked it out at http://ideone.com/u43VJ , it works with Python3 (can you please note this). Thanks!

Java Solution
public static void main(String[] args) {
        int INPUT = 5;
        String[][] grid = new String[INPUT][INPUT];
        int xDirection = 0;
        int yDirection = 0;
        int flag = 1;
        for (int i = 0; i < INPUT * INPUT; i++) {
            String temp = "";
            for (int k = 0; k < (""+INPUT*INPUT).length() - ("" + (i + 1)).length(); k++) {
                temp += "" + 0;
            }
            temp += (i + 1);

            if (xDirection > INPUT-1)
                {flag=2; yDirection++; xDirection--; i--; continue;}
            else if (yDirection > INPUT -1)
                {flag=3; yDirection--; xDirection--; i--; continue;}
            else if (xDirection < 0)
                {flag=4; xDirection++; yDirection--; i--; continue;}

            if ( grid[xDirection][yDirection]==null ){
                    grid[xDirection][yDirection] = ""+temp;
            }
                else{
                if (flag ==1 ) {
                    flag=2;
                    xDirection--;
                }
                else if (flag ==2){
                    flag=3;
                    yDirection--;
                }
                else if (flag==3){
                    flag=4;
                    xDirection++;
                }
                else{
                    flag=1;
                    yDirection++;
                }
                i--;
            }
            switch(flag){
            case 1: xDirection++;break;
            case 2: yDirection++;break;
            case 3: xDirection--;break;
            case 4: yDirection--; break;
            }
        }
        for (int i = 0; i < INPUT; i++) {
            for (int k = 0; k < INPUT; k++)
                System.out.print(grid[i][k] + " ");
            System.out.println();
        }
    }

sample output for input 10
001 036 035 034 033 032 031 030 029 028
002 037 064 063 062 061 060 059 058 027
003 038 065 084 083 082 081 080 057 026
004 039 066 085 096 095 094 079 056 025
005 040 067 086 097 100 093 078 055 024
006 041 068 087 098 099 092 077 054 023
007 042 069 088 089 090 091 076 053 022
008 043 070 071 072 073 074 075 052 021
009 044 045 046 047 048 049 050 051 020
010 011 012 013 014 015 016 017 018 019

Cool, I have checked it out and it works: http://ideone.com/mLoJX

But, it prints extra information, only the desired output is needed. And, it will be super-cool if it can be made less verbose.

Also, the main function should be put in a class.

Ah!..forgot to comment debugging sysouts :(

maybe you can fix it in your code?

Perl, 178 chars
Uses Math::Complex and maintains the current direction in a complex variable (1/i/-1/.i). Run with:
$ perl -MMath::Complex spiral.pl

Put N in $l.
# $l = shift;
$d=i;
$x=0;
until($s{$x}){
    $s{$x}=++$n;
    $x+=$d;
    $d*=-i if
        Re($x)==Im($x)+(Re($x)<$l/2)
        ||Re($x)==$l-1-Im($x)
}
for$y(0..$l-1){
    printf'%0'.length($l**2).'d ',$s{$_+i*$y}for 0..$l-1;
    print"\n"
}

C
#include<stdio.h>
#include<math.h>

int main() {
    int A[42][42],i,j,N,c=1,k;
    scanf("%d",&N);
    for (i = 0, j = N - 1 ; j >= 0 ; i++, j--) {
            for(k = i ; k < j; k++)A[i][k]=c++;
            for(k = i ; k < j; k++)A[k][j]=c++;
            for(k = j ; k > i; k--)A[j][k]=c++;
            for(k = j ; k > i; k--)A[k][i]=c++;
    }
    if (N%2)
       A[N/2][N/2]=c;
    for (i=0;i<N;i++) {
        for (j=0;j<N;j++)
            printf("%0*d ",((int)log10(N*N)+1),A[j][i]);
        printf("\n");
    }
}

Python 2.7:
def spiral(n):
   rows = [[n * n]]
   current = n * n - 1

   while current:
      rows = zip(*([range(current, current - len(rows[0]), -1)] + rows))[::-1]
      current -= len(rows)

   digits = len(str(n * n))
   for row in rows:
      print" ".join(str(cell).zfill(digits) for cell in row)

spiral(5)

PHP, 272 chars including comment
Func-based, recursive version - more interesting for me as it better expresses intention. It works for distinct width and height too.
<?php

$n = $argv[1];

for($y = 0; $y<$n; $y++){
    for($x = 0; $x<$n; $x++)
        printf("%02d ", f($n, $n, $x, $y));

    echo "\n";
}

function f($w, $h, $x, $y){
    return ($y)
        ?$w + f($h - 1, $w, $y - 1, $w - $x - 1) //strip-off first row and "rotate"
        :$x;
}

Output:
C:\www>php -f golfed_spiral.php 8
00 01 02 03 04 05 06 07
27 28 29 30 31 32 33 08
26 47 48 49 50 51 34 09
25 46 59 60 61 52 35 10
24 45 58 63 62 53 36 11
23 44 57 56 55 54 37 12
22 43 42 41 40 39 38 13
21 20 19 18 17 16 15 14

C#, 380-ish golfed
I didn't bother pasting in the golfed version as I was pretty confident this wasn't going to break any records. But I wanted to give it a shot thinking about it a bit differently. Rather than write out each line or position as I come to it, I'm moving the cursor into position, writing out the starting center number, and spiraling out from there (which illustrated an interesting pattern of positions-to-move per direction change).
There's a fair amount of character space wasted getting the console buffer to accept the larger values as well calculating the position for the upper left corner (which I'm sure can be improved).
At any rate, it was an interesting exercise.
    static void Main(string[] p)
    {
        int squareSize = 4;
        Console.BufferHeight = 300;
        Console.BufferWidth = 300;

        int maxTravel = 0;
        int currentTravel = 0;
        int travelCounter = 0;
        var a = squareSize % 2 == 0;
        int direction = a ? 2 : 0;
        int pad = squareSize * squareSize;
        int padLength = (pad + "").Length;

        int y = a ? (squareSize / 2) - 1 : (squareSize - 1) / 2;
        int x = a ? y + 1 : y;
        x = x + (x * padLength);

        for (int i = pad; i > 0; i--)
        {
            Console.SetCursorPosition(x, y);
            Console.Write((i + "").PadLeft(padLength, '0') + " ");

            switch (direction)
            {
                case 0:
                    y--;
                    break;

                case 1:
                    x += padLength + 1;
                    break;

                case 2:
                    y++;
                    break;

                case 3:
                    x -= padLength + 1;
                    break;
            }

            if (++currentTravel > maxTravel)
            {
                currentTravel = 0;
                direction = ++direction % 4;

                if (++travelCounter == 2)
                {
                    travelCounter = 0;
                    maxTravel++;
                }
            }

        }
    }

Ruby
This isn't a particularly good golfable solution, but it might be of algorithmic interest.
I've always been fascinated by a similar problem, namely, finding the clockwise spiral path through an NxM matrix. One really intuitive way of solving that problem is to keep rotating the matrix counterclockwise and peel it like an orange. I use a similar — albeit not as elegant — method to do the reverse:
def spiral_matrix(n)
  matrix = Array.new(n) { Array.new(n) }
  path = [*1..n*n]
  padding = (n*n).to_s.size
  layer = 0
  until path.empty?
    matrix[layer].map! { |l| l || path.shift }
    matrix = matrix.transpose.reverse
    layer += 1 unless matrix[layer].include?(nil)
  end
  matrix = matrix.transpose.reverse until matrix[0][0] == 1
  matrix.transpose.each do |row|
    row.each do |l|
      print "%0#{padding}d" % l, ' '
    end
    puts
  end
end

Racket
Just wanted to try it with a solution using close to 0 memory. No array, no nothing. The value can be generated for any position anytime. We could ask a spiral of any size (if what receives the output stream can handle it). In hope that someone ever needs gigantic spirals.
Here's the code
; number of chars required to write x in base 10
; defined for x > 0
(define log10
  (λ (x)
    (inexact->exact
     (+ 1 (floor (/ (log x) (log 10)))))))

; tells the square number
; works for squares of both even and odd sizes
; outer square # = 0
(define square#
  (λ (x y size) ; x and y begin at 0
    (min x y
         (- size 1 x)
         (- size 1 y))))

; tells the number of values in a square
(define square-val-qty
  (λ (sqr# size) ; size is the whole spiral size
    (let ((res (* 4 (- size (* 2 sqr#) 1))))
      (cond
        ((zero? res) 1)
        (else res)))))

; at which value a square starts
; works for odd/even spirals
(define square-1st-val
  (λ (sqr# size)
    (+ (* 4 sqr# (- size sqr#)) 1)))

; square size from spiral size
(define square-side
  (λ (sqr# size)
    (- size (* 2 sqr#))))

(define 1+
  (λ (n)
    (+ n 1)))

(define 1-
  (λ (n)
    (- n 1)))

; calculates the position on the square (from 0)
(define position-on-square
  (λ (x y size)
    (let* ((sqr#     (square# x y size))
           (sqr-x    (- x sqr#))
           (sqr-y    (- y sqr#))
           (sqr-side (square-side sqr# size)))
      (cond
        ((and (zero? sqr-x) (< sqr-y (1- sqr-side))) ; left part
         sqr-y)
        ((and (eq? sqr-y (1- sqr-side)) (< sqr-x (1- sqr-side))) ; bottom
         (+ (1- sqr-side) sqr-x))
        ((and (not (eq? sqr-y 0)) (eq? sqr-x (1- sqr-side))) ; right
         (+ (* 2 (1- sqr-side)) (- sqr-side sqr-y 1)))
        (else ; top
         (+ (* 3 (1- sqr-side)) (- sqr-side sqr-x 1)))))))

; returns the spiral value at the given position
(define spiral-value
  (λ (x y size)
    (+ (square-1st-val (square# x y size) size)
       (position-on-square x y size))))

; pads a string with char
(define left-pad
  (λ (str char width)
    (cond
      ((< (string-length str) width)
       (left-pad (string-append (string char) str) char width))
      (else
       str))))

; draws a spiral!
(define draw-spiral
  (λ (size)
    (let ((x 0)
          (y 0)
          (width (log10 (* size size))))
      (letrec ((draw
                (λ ()
                  (printf "~a " (left-pad (number->string (spiral-value x y size)) #\0 width))
                  (cond
                    ((and (eq? x (1- size)) (eq? y (1- size)))
                     (printf "~n~n"))
                    ((eq? x (1- size))
                     (set! x 0)
                     (set! y (1+ y))
                     (printf "~n")
                     (draw))
                    (else
                     (set! x (1+ x))
                     (draw))))))
        (draw)))))

Testing with this
(draw-spiral 1)
(draw-spiral 2)
(draw-spiral 3)
(draw-spiral 4)
(draw-spiral 5)
(draw-spiral 15)
(draw-spiral 16)

Results in output
1

1 4
2 3

1 8 7
2 9 6
3 4 5

01 12 11 10
02 13 16 09
03 14 15 08
04 05 06 07

01 16 15 14 13
02 17 24 23 12
03 18 25 22 11
04 19 20 21 10
05 06 07 08 09

001 056 055 054 053 052 051 050 049 048 047 046 045 044 043
002 057 104 103 102 101 100 099 098 097 096 095 094 093 042
003 058 105 144 143 142 141 140 139 138 137 136 135 092 041
004 059 106 145 176 175 174 173 172 171 170 169 134 091 040
005 060 107 146 177 200 199 198 197 196 195 168 133 090 039
006 061 108 147 178 201 216 215 214 213 194 167 132 089 038
007 062 109 148 179 202 217 224 223 212 193 166 131 088 037
008 063 110 149 180 203 218 225 222 211 192 165 130 087 036
009 064 111 150 181 204 219 220 221 210 191 164 129 086 035
010 065 112 151 182 205 206 207 208 209 190 163 128 085 034
011 066 113 152 183 184 185 186 187 188 189 162 127 084 033
012 067 114 153 154 155 156 157 158 159 160 161 126 083 032
013 068 115 116 117 118 119 120 121 122 123 124 125 082 031
014 069 070 071 072 073 074 075 076 077 078 079 080 081 030
015 016 017 018 019 020 021 022 023 024 025 026 027 028 029

001 060 059 058 057 056 055 054 053 052 051 050 049 048 047 046
002 061 112 111 110 109 108 107 106 105 104 103 102 101 100 045
003 062 113 156 155 154 153 152 151 150 149 148 147 146 099 044
004 063 114 157 192 191 190 189 188 187 186 185 184 145 098 043
005 064 115 158 193 220 219 218 217 216 215 214 183 144 097 042
006 065 116 159 194 221 240 239 238 237 236 213 182 143 096 041
007 066 117 160 195 222 241 252 251 250 235 212 181 142 095 040
008 067 118 161 196 223 242 253 256 249 234 211 180 141 094 039
009 068 119 162 197 224 243 254 255 248 233 210 179 140 093 038
010 069 120 163 198 225 244 245 246 247 232 209 178 139 092 037
011 070 121 164 199 226 227 228 229 230 231 208 177 138 091 036
012 071 122 165 200 201 202 203 204 205 206 207 176 137 090 035
013 072 123 166 167 168 169 170 171 172 173 174 175 136 089 034
014 073 124 125 126 127 128 129 130 131 132 133 134 135 088 033
015 074 075 076 077 078 079 080 081 082 083 084 085 086 087 032
016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031

Quite CPU intensive compared to precalculated matrices if you need the whole spiral, but might be useful. Who knows! E.g.:
(spiral-value 1234567 7654321 234567890)  ->  1152262488724319

Didn't golf it... It's quite small despite the appearance. I used long names and comments.

Python 2, 800 bytes
from collections import namedtuple
Crd = namedtuple('Crd',['row','col','val'])
C1 = Crd(1,1,1)
def add(c1, c2):
    return Crd(c1.row + c2.row, c1.col + c2.col, c1.val + c2.val)
def deltas(l):
    for i in xrange(1,l): yield Crd(0,1,1)
    for i in xrange(1,l): yield Crd(1,0,1)
    for i in xrange(1,l): yield Crd(0,-1,1)
    for i in xrange(1,l-1): yield Crd(-1,0,1)
def ring(c, l):
    yield c
    for d in deltas(l):
        c = add(c, d)
        yield c
def spiral(n):
    cur = C1
    while n > 0:
        for c in ring(cur, n):
            yield c
            cur = c
        cur = add(cur, Crd(0,1,1))
        n -= 2
n    = input()
fmt  = '%' + str(len(str(long(n*n)))) + 'd'
crds = sorted(list(spiral(n)))
for r in xrange(1,n+1):
    print ' '.join([fmt % c.val for c in crds if c.row == r])

Try it online!
A few years back a friend of mine was asked this question in an interview.  They told me about it at our family's Thanksgiving dinner so I think of this as the "Thanksgiving problem".

PHP, 172 171+1 bytes, 24 operations
creates an array walking the indexes through a spiral; then prints the result.
// 1) input squared -> 2) string length -> 3) $e = length of maximum number
for($e=strlen($argn**2);
    // 4) decrement input (line length) every second iteration; 5) loop while input>0
    $argn-=$i%2;
    // 24) post-increment iteration counter $i
    $i++)
    // 6,7,8) loop through current line
    for($p=$argn;$p--;)$r
        // 9) $i=$i modulo 4; 10,11) (1-$i)%2 == [1,0,-1,0][$i] -> 12) increment/decrement $y coordinate3
        [$y+=(1-$i%=4)%2]
        // 13,14) (2-$i)%2 == [0,1,0,-1][$i] -> 15) increment/decrement $x coordinate
        [$x+=(2-$i)%2]
        // 16) print formatted to string; 17) assign to field [$y,$x] in $r
        =sprintf("%0{$e}d ",++$n);
// 18) pre-increment row counter $z; 19) loop while row exists
for(;$r[++$z];
    // 21) join row; 22) append newline; 23) print
    print join($r[$z])."\n")
    // 20) sort row by indexes
    ksort($r[$z]);

Run as pipe with -nR or try it online.
Add one assignment to save five bytes: replace the final loop with
for(;$s=$r[++$z];print join($s)."\n")ksort($s);

Sample code : This works for 4x5 but failing 3x5
while (k < m && l < n)
    {
        /* Print the first row from the remaining rows */
        for (i = l; i < n; ++i)
        {
            printf("%d ", a[k][i]);
        }
        k++;
    /* Print the last column from the remaining columns */
    for (i = k; i < m; ++i)
    {
        printf("%d ", a[i][n-1]);
    }
    n--;

    /* Print the last row from the remaining rows */
    if ( k < m)
    {
        for (i = n-1; i >= l; --i)
        {
            printf("%d ", a[m-1][i]);
        }
        m--;
    }

    /* Print the first column from the remaining columns */
    if (l < n)
    {
        for (i = m-1; i >= k; --i)
        {
            printf("%d ", a[i][l]);
        }
        l++;
    }
}

Welcome to PPCG! This is code golf. Please show some effort to solve the problem in as few characters as possible. In particular, you can use single-character variable names, remove unnecessary whitespace and comments. Please also include the byte count of your submission after you've reduced it. You can always keep the readable version in addition to the golfed one.

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


text:
Roman numeral converter function
Create the shortest function to convert a string of Roman numerals to an integer.
The rules for each letter can be found at the Wikipedia page.  Letters above 1,000 will have parentheses placed around them to signal their higher value.
Requirements:

Must convert Roman numerals 1 to 500,000
Must complete in less than a minute
Does not use built-in functions that could provide an advantage (Ex: A function that converts Roman numerals to integers)
Is a function

The function does not need to support fractions.  Any invalid input should return the number 0.
Shortest function wins.  In the case of a tie, the one with the most votes wins.
Test Cases
Input
III

Output
3

Input
IIII

Output
0

Input
XVI

Output
16

Input
(C)(D)(L)MMI

Output
452001

Unless I'm missing something, (C)(D)(L)MMI would be 452,001. How did you get your value? Additionally, does this need to support "improper" forms (e.g. IC instead of XCIX)?

Improper to me means illegal and thus should return 0.

@Anon: The number was a mistype from when I changed the original third test case.  It does not need to support improper forms, as it would be considered invalid input.

Standard practice (and the spec of this question's duplicate) is for invalid input to be undefined behavior. Since this question is four years old and had only one answer, should we change the requirements?

@ThomasKwa I'm strongly considering it. Though I might as well mention that the standard practice of having invalid input being undefined behaviour came after this question.

@KevinBrown I don't see a source or explanation for the parenthesised letters. I think you should change the spec to match http://codegolf.stackexchange.com/q/16254/43319 and then the answers from there can be migrated here.

C++: 914 855 chars
#include<map>
#include<string>
#include<iostream>
#include<sstream>
#define I istream
#define T(C) if(C)throw int(1);
#define X(c,v,f,m) D[c]=v;P[c]=D[f];M[c]=m;
#define S second
using namespace std;typedef map<char,int>R;R D,P,M;struct U{U():t(0),l(0),a(0){}int t,l,a;operator int(){return t+l;}I&d(I&s){char c,b;s>>c;if(c=='('){s>>c>>b;T(b!=')')c+=32;}if(s){R::iterator f=D.find(c);T(f==D.end())if(P[c]==l){l=f->S-l;a=0;}else{T(l&&(f->S>l))a=l==f->S?a+1:1;T(a>M[c])t+=l;l=f->S;}}return s;}};I&operator>>(I&s,U&d){return d.d(s);}int main(){D[' ']=-1;X(73,1,32,3)X(86,5,73,1)X(88,10,73,3)X(76,50,88,1)X(67,100,88,3)X(68,500,67,1)X(77,1000,67,3)X(118,5000,77,1)X(120,10000,77,3)X(108,50000,120,1)X(99,100000,120,3)X(100,500000,99,1)X(109,1000000,99,3)string w;while(cin>>w){try{stringstream s(w);U c;while(s>>c);cout<<c<<"\n";}catch(int x){cout<<"0\n";}}}

It could be compressed further.
> ./a.exe
III
3
IIII
0
XVI
16
(C)(D)(L)MMI
452001

Slightly nicer formatting: 1582 char
#include<map>
#include<string>
#include<iostream>
#include<sstream>
#define I istream
#define T(C) if(C)throw int(1);
#define X(c,v,f,m) D[c]=v;P[c]=D[f];M[c]=m;
#define S second
using namespace std;

typedef map<char,int>      R;

R     D,P,M;

struct U
{
    U(): t(0), l(0), a(0) {}

    int  t,l,a;

    operator int()
    {
        return t + l;
    }
    I& d(I& s)
    {
        char c,b;
        s >> c;
        if (c == '(')
        {
            s >> c >> b;
            T(b != ')')
            c = tolower(c);
        }
        if (s)
        {
            R::iterator f = D.find(c);
            T(f == D.end())

            if (P[c] == l)
            {
                l = f->S - l;
                a = 0;
            }
            else
            {
                T(l&&(f->S > l))
                a=l==f->S?a+1:1;
                T(a>M[c])
                t   += l;
                l     = f->S;
            }
        }

        return s;
    }

};

I& operator>>(I& s,U& d)
{
    return d.d(s);
}

int main()
{
    D[' ']=-1;
    X(73,1,32,3)
    X(86,5,73,1)
    X(88,10,73,3)
    X(76,50,88,1)
    X(67,100,88,3)
    X(68,500,67,1)
    X(77,1000,67,3)
    X(118,5000,77,1)
    X(120,10000,77,3)
    X(108,50000,120,1)
    X(99,100000,120,3)
    X(100,500000,99,1)
    X(109,1000000,99,3)

    string w;
    while(cin >> w)
    {
        try
        {
            stringstream s(w);
            U    c;
            while(s >> c);
            cout << c << "\n";
        }
        catch(int x)
        {
            cout << "0\n";
        }
    }
}

I don't think you need a space between the macro functions and their definitions.

Javascript, 317 chars
function f(s){for(r=/\(?(.\)?)/g,t=e=0;a=r.exec(s);l=a[0].length,d='IXCMVLD'.indexOf(a[1][0]),e=e||d<0||l==2||d*4+l==3,t+='+'+(d>3?5:1)*Math.pow(10,d%4+3*(l>1)));t=t&&t.replace(/1(0*).(10|5)\1(?!0)/g,'$2$1-1$1');return e||/[^0](0*)\+(10|5)\1/.test(t)||/(\+10*)\1{3}(?!-)/.test(t)||/-(10*)\+\1(?!-)/.test(t)?0:eval(t)}

Explaination:
function f(s){
      // iterate over every character grabbing parens along the way
  for(r=/\(?(.\)?)/g,t=e=0;a=r.exec(s);
        // get a numerical value for each numeral and join together in a string
    l=a[0].length,
    d='IXCMVLD'.indexOf(a[1][0]),
    e=e||d<0||l==2||d*4+l==3,    // find invalid characters, and parens
    t+='+'+(d>3?5:1)*Math.pow(10,d%4+3*(l>1))
  );
      // reorder and subtract to fix IV, IX and the like
  t=t&&t.replace(/1(0*).(10|5)\1(?!0)/g,'$2$1-1$1');
  return e||
    /[^0](0*)\+(10|5)\1/.test(t)|| // find VV,IIV,IC,...
    /(\+10*)\1{3}(?!-)/.test(t)||  // find IIII,... but not XXXIX
    /-(10*)\+\1(?!-)/.test(t)      // find IVI,... but not XCIX
      ?0:eval(t)
}

Without error detection it is only 180 chars
function g(s){for(r=/\(?(.\)?)/g,t=0;a=r.exec(s);d='IXCMVLD'.indexOf(a[1][0]),t+='+'+(d>3?5:1)+'0'.repeat(d%4+3*(a[1].length>1)));return eval(t.replace(/(1(0*).(10|5)\2)/g,'-$1'))}

This works the same way, but here is better formatting:
function g(s){
  for(r=/\(?(.\)?)/g,t=0;a=r.exec(s);
    d='IXCMVLD'.indexOf(a[1][0]),
    t+='+'+(d>3?5:1)+'0'.repeat(d%4+3*(a[1].length>1))
  );
  return eval(t.replace(/(1(0*).(10|5)\2)/g,'-$1'))
}

J, 43 bytes
1#.2([*_1^<)/\0,~(*/\1,6$5 2){~'IVXLCDM'&i.

Try it online!

Python3 - 144 chars
Follows this question's rules, but its closed, so doesn't check for invalid input or support brackets, but thought I'd answer anyway.
def r(s):
    if not s:return 0
    l,v=[(s.split(x,1),6-i) for i,x in enumerate('MDCLXVI') if x in s][0]
    return 10**(v//2)*(v%2*4+1)-r(l[0])+r(l[1])

Explanation:
This algorithm recursively finds the next largest letter, splits the string around it, then subtracts the left side's value and adds the right side's value.
Ungolfed:
def roman(string):
    # base case. ends the recursion when either side string is empty.
    if not string:
        return 0

    split_list, value =
        [
            # splits the string with the leftmost letter of 'MDCLXVI' successively.
            # we take the first split string in the list (ignoring ones that didn't split)
            #  and use [0] and [1] as the left and right hand side parts to recurse.

            # stores the split string ('1' means first split only), and the index of the
            #  letter used to split it in a tuple.
            ( string.split(letter, 1), 6-index )

            # loops through each letter used in roman numerals.
            for index, letter in enumerate('MDCLXVI')

            # only stores split strings which actually split
            if letter in string

        # get the first split string tuple (so it was split with the highest value letter).
        ][0]

    # takes the index of roman numeral letter and turns into its value (0->1, 1->5, 2->10).
    return 10**(value//2)*(value%2*4+1)
        # subtracts the value of the left hand side.
        - roman(split_list[0])
        # adds the value of the right hand side.
        + roman(split_list[1])


text:
Is this figure connected?
You are given a list of (x,y) grid coordinates.  Your function should decide whether the figure obtained by coloring in the squares of the grid with the given coordinates is connected or not.
Squares adjacent diagonally are not considered connected.
Example input:
(0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),
(1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)

which looks like:
****
*
****
   *
****

Output:
YES

Example input:
(0,0),(1,0),(2,0),(0,1),(0,2),(2,2),(3,2),(4,2),(0,3),
(4,3),(0,4),(1,4),(2,4),(4,4),(4,5),(2,6),(3,6),(4,6)

which looks like:
  ***
    *
*** *
*   *
* ***
*
***

Output:
NO

Your function must take as input a list of pairs of integers (e.g. in C++, maybe vector<pair<int,int>>) and return a boolean.  You may not assume any particular ordering of the input points.  The coordinates will be between 0 and 99 inclusive.
Smallest code wins.

Are x,y non-negative?

What's the upper limit of x and y?

Ruby - 82
c=->s{(a=->x,y{a[x,y-1]&a[x+1,y]&a[x,y+1]&a[x-1,y]if s.delete [x,y];s})[*s[0]][0]}

Ungolfed:
def c(s)
        a=->x,y{
            if s.delete([x,y])
                a[x,y-1]
                a[x+1,y]
                a[x,y+1]
                a[x-1,y]
            end
        }
        x,y=s.first
        a[x,y]
        s.size != 0
end

Usage:
print s([ [0,0],[2,0],[3,0],[3,1],[3,2],[2,2],[1,2],
    [0,2],[0,3],[0,4],[1,4],[2,4],[3,4]
]) ? "NO" : "YES"

c99 -- 620ish neccessary characters
#include <stdlib.h>
#define S return
typedef struct n N;struct n{int x,y;N*n;};
N*I(int x,int y,N*l){if(!l)goto z;N*m=l;do{if((m->x==x)&&(m->y==y))
S m;m=m->n;}while(m!=l);z:S NULL;}N*A(N*n,N*l){if(!l)n->n=n,l=n;
else n->n=l->n,l->n=n;S l;}N*R(N*n,N*l){if(!l||(l==n&&n->n==n))goto z;
N*m=l;do{if(m->n==n){m->n=n->n;S m;}m=m->n;}while(m!=l);z:S NULL;}
int E(N*l){int i=0;if(!l)goto z;N*m=l;do{++i;m=m->n;}while(m!=l);z:S i;}
int C(N*l){N*c=NULL,*n=l,*m=l=R(n,l);c=A(n,c);int a=E(l)*E(l);do{
if(!l)S 1;n=m->n;if(I(m->x-1,m->y,c)||I(m->x+1,m->y,c)||I(m->x,m->y-1,c)
||I(m->x,m->y+1,c))l=R(m,l),c=A(m,c);m=n;}while(--a);S 0;}

More than half the bulk is taken up by a minimal implementation of a linked list---c is horribly deficient in that sense.
The code here includes the definition of the nodes and all the list manipulation functions called by C, my connectedness checker.
The method is to maintain two lists (one of connected nodes initialized by the first node) and one of yet-to-be-connected nodes (starting with everything else). What follows is an exhaustive cyclic search to find a connection for each node in turn. There is an upper limit on the number of attempts conservatively set to length-of-the-list squared, which marks the end of attempts. Very inefficient, but functional.
It completes several simple cases of my own devising and both of the given test cases correctly.
Full program with test scaffold and some comments
#include <stdio.h>
#include <stdlib.h>
typedef struct n N;
struct n{
  int x,y;
  N*n;
};
N*I(int x,int y,N*l){ /* Return pointer to node x,y in l or NULL */
  if(!l)goto z;
  N*m=l;
  do{
    if((m->x==x)&&(m->y==y)){
      return m;
    }
    m=m->n;
  }while(m!=l);
 z:return NULL;
};
N*A(N*n,N*l){ /* Add node n to list l. Return the new l */
  if(!l){
    n->n=n;
    l=n;
  }else{
    n->n=l->n;
    l->n=n;
  }
  return l;
};
N*R(N*n,N*l){ /* Remove node n from list l. Return the new l */
  if(!l||(l==n&&n->n==n))goto z;
  N*m=l;
  do{
    if(m->n==n){m->n=n->n; return m;}
    m=m->n;
  }while(m!=l);
 z:return NULL;
}
int E(N*l){ /* Return the Enumberation of nodes in list l */
  int i=0;
  if(!l)goto z;
  N*m=l;
  do{++i;m=m->n;}while(m!=l);
 z:return i;
}
int C(N*l){ /* return true if all nodes in list l are connected */
  N*c=NULL,*n=l,*m=l=R(n,l); /* put the first node in the connected
                            list, and mark the start of the
                            working list */
  c=A(n,c);
  int a=E(l)*E(l); /* maximum number of times to try to place nodes */
  do {
    if (!l) return 1; /* when l is empty: we win! */
    n=m->n;
    if ( I(m->x-1,m->y  ,c) ||
     I(m->x+1,m->y  ,c) ||
     I(m->x  ,m->y-1,c) ||
     I(m->x  ,m->y+1,c) ) l=R(m,l), c=A(m,c);
    m=n;
  } while (--a);
  return 0;
}
void P(N*l){ /* Print the list */
  printf("List: [");
  if(!l)goto z;
  N*m=l;
  do{printf(" (%d, %d)",m->x,m->y);m=m->n;}while(m!=l);
 z:printf(" ]\n");
}
N*G(int x,int y){ /* generate a new node with (x, y) */
  N*n;
  if(n=malloc(sizeof(N)))n->x=x,n->y=y;
  return n;
}
int main(){
  N*n,*l=NULL;

  n=G(0,0); l=A(n,l);
  n=G(1,0); l=A(n,l);
  n=G(2,0); l=A(n,l);
  n=G(0,1); l=A(n,l);
  n=G(0,2); l=A(n,l);
  n=G(2,2); l=A(n,l);
  n=G(3,2); l=A(n,l);
  n=G(4,2); l=A(n,l);
  n=G(0,3); l=A(n,l);

  n=G(4,3); l=A(n,l);
  n=G(0,4); l=A(n,l);
  n=G(1,4); l=A(n,l);
  n=G(2,4); l=A(n,l);
  n=G(4,4); l=A(n,l);
  n=G(4,5); l=A(n,l);
  n=G(2,6); l=A(n,l);
  n=G(3,6); l=A(n,l);
  n=G(4,6); l=A(n,l);

  P(l);
  if (C(l)) {
    printf("Connected!\n");
  } else {
    printf("Not connected.\n");
  };
}

My first python version (loosely) translated into golfscript. Urgh. 80 chars.
{1$!!1$!!&{(~:v;:u;[1u+v u 1v+u 1- v u v 1-]2/@.@&.@\-\@|g}{;!}if}:g;{([.;]g}:f;

test cases:
# test cases
[[0 0] [1 0] [2 0] [3 0] [3 1] [3 2] [2 2] [1 2] [0 2] [0 3] [0 4] [1 4] [2 4] [3 4]]:a0;
[[0 0] [1 0] [2 0] [0 1] [0 2] [2 2] [3 2] [4 2] [0 3] [4 3] [0 4] [1 4] [2 4] [4 4] [4 5] [2 6] [3 6] [4 6]]:a1;
a0 f p
a1 f p

python 2.6;  second attempt
def f(a):
    a = set(a)
    e = lambda (x, y) : set([(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)])
    p = lambda k : a.discard(k) or map(p, e(k) & a)
    p(a.pop())
    return not a

python 2.6;  first attempt
def f(a):
    a = set(a)
    e = lambda (x, y) : set([(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)])
    b = set([a.pop()])
    while b and a:
        c = a & e(b.pop())
        a -= c
        b |= c
    return not a

usage:
a_0 = [
    (0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),
    (1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)
]
a_1 = [
    (0,0),(1,0),(2,0),(0,1),(0,2),(2,2),(3,2),(4,2),(0,3),
    (4,3),(0,4),(1,4),(2,4),(4,4),(4,5),(2,6),(3,6),(4,6)
]
for a in (a_0, a_1):
    print 'YES' if f(a) else 'NO'

Could you please keep to one language per answer? It's a bit hard to know what we're voting for now.

Perl, 130 133
A simple mark-and-sweep depth-first traversal, made much longer than I'd like by Perl sigils.
sub g{my($a,$b)=@_;g($a-1,$b),g(
$a+1,$b),g($a,$b-1),g($a,$b+1)if
delete$m{$a,$b}}sub f{($a,$b)=@_;
$m{pop,pop}++while@_;g$a,$b;!%m}

Sample use:
say f( (0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),
       (1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4) )
  ? 'YES' : 'NO';
say f( (0,0),(1,0),(2,0),(0,1),(0,2),(2,2),(3,2),(4,2),(0,3),
       (4,3),(0,4),(1,4),(2,4),(4,4),(4,5),(2,6),(3,6),(4,6) )
  ? 'YES' : 'NO';

You can reduce this to 122: sub f{@c=@_;$m{pop,pop}++while@_;g@c;!%m}

Prolog - 118
c([_]).
c([[X,Y]|L]):-member([A,B],[[X+1,Y],[X-1,Y],[X,Y+1],[X,Y-1]]),C is A,D is B,select([C,D],L,N),c([[C,D]|N]),!.

Usage:
?- c([[0,0],[1,0],[2,0],[3,0],[3,1],[3,2],[2,2],[1,2],[0,2],[0,3],[0,4],[1,4],[2,4],[3,4]]).
true.

?- c([[0,0],[1,0],[2,0],[0,1],[0,2],[2,2],[3,2],[4,2],[0,3],[4,3],[0,4],[1,4],[2,4],[4,4],[4,5],[2,6],[3,6],[4,6]]).
false.

Why do you need the C is A,D is B?

Fails on c([[1,0],[0,0],[2,0]]).

@JB: you need the C is A, D is B to evaluate the new coordinates. Suppose you have A=X+1, then C is A evaluates X+1 to the actual value.

d'oh. Thanks. My prolog is getting rusty.

Perl - 150
sub f{$m[pop][pop]++while@_;for$i(0..@m){for$j(0..9){$_.=$m[$i][$j]||0}$_.="3"}s/1/2/;for$n(0..99){s/(?<=2)1|1(?=2)|1(?=.{10}2)|(?<=2.{10})1/2/}!m/1/}

Works for 10 columns. For more I'd need another character.
Expands the color of one square a lot of times with one regex. Building the string takes a lot more space than I'd like it to.
Ungolfed:
sub f{
    $m[pop][pop]++ while @_;
    for $i (0..@m) {
        for $j (0..9) {
            $_ .= $m[$i][$j] || 0
        }
        $_ .= "3";
    }
    s/1/2/;
    for$n(0..99) {
        s/(?<=2)1|1(?=2)|1(?=.{10}2)|(?<=2.{10})1/2/
    }
    !m/1/
}

print f((0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2), (1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)) ? YES : NO;

Haskell 98, 98
g p@(x,y)z|elem p z=foldr g(filter(/=p)z)[(x-1,y),(x+1,y),(x,y-1),(x,y+1)]|0<1=z
f z=null$g(z!!0)z

Sample use:
*Main> f [(0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),
          (1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)]
True
*Main> f [(0,0),(1,0),(2,0),(0,1),(0,2),(2,2),(3,2),(4,2),(0,3),
          (4,3),(0,4),(1,4),(2,4),(4,4),(4,5),(2,6),(3,6),(4,6)]
False

Sage: 55 53 char
graphs.GridGraph([100]*2).subgraph(x).is_connected()

Where x is a list of coordinates,
x=[(0,0),(1,0),(2,0),(3,0),(3,1),(3,2),(2,2),(1,2),(0,2),(0,3),(0,4),(1,4),(2,4),(3,4)]