text:
Electron Configurations
Electron Configurations
Your mission is to accept an element's atomic number as input, and output its electron configuration (e.g. 2,8,8,2 for calcium).
Input
An atomic number from 1 to 118. You may assume valid input. The atom is not charged (it has as many electrons as protons). You may not expect the input to be stored in a variable, and you must write a complete program.
Output
The number of electrons in each non-empty electron shell. I will be quite lenient with the output format; all of the following are acceptable, i.e. you may use any punctuation or whitespace to separate the numbers, and brackets of any sort are permitted. Please specify which is used.

2,8,8,2
2.8.8.2
2, 8, 8, 2,
[2,8,8,2]
2 8 8 2
([2 [8]] [8] 2)

How Electrons Work
In atoms, electrons are ordered into "shells", which are energy levels. Each shell has a certain capacity, the maximum number of electrons that it is capable of holding. The shells are filled from the inside out, but not evenly. Your task is to determine, given an atomic number, how many electrons there are in each shell, according to this source.
Up to and including calcium (atomic number 20), the shells fill evenly and in order; the inner shell is first filled to its capacity of 2, the second to 8, then the third to 8 and the last to 2. The electron configuration of calcium is 2,8,8,2.
After calcium, things get complicated; further electrons go into the third shell, not the last one. To make things worse, vanadium (23) is 2,8,11,2, while chromium (24) is 2,8,13,1 and manganese (25) is 2,8,13,2.
There are some consistent patterns, however: a noble gas and the seven elements before it will always have the number of electrons in the outer shell increase from 1 to 8. For example:

gold (79): 2,8,18,32,18,1
mercury (80): 2,8,18,32,18,2
...
astatine (85): 2,8,18,32,18,7
radon (86): 2,8,18,32,18,8

Rules

Standard loopholes are forbidden.
Libraries which existed prior to this challenge are permitted.
Any built-in or library features which specifically deal with atoms, molecules or chemistry are banned.
Lowest code length in bytes wins.
In the linked source, configurations of elements 103-118 are marked with (?), as they are predicted, and the elements are too unstable for this to be checked. For this challenge, assume them to be correct.
You may hardcode part or all of your data.
[NEW RULE] Please provide a base64 or an xxd dump of your files if you use control characters in them (as many answers seem to be doing)

WINNER: Dennis's CJam answer at 80 bytes!

CJam, 87 83 82 80 bytes
0"hTHøìð¼Ä¿håêÛ¾ªÔ¼"256b6b5a/4a8**li<{[33:B_B*65_B*1]=\_B%8=B\#*+}/Bb0-`

The above code contains unprintable characters.
Try it online in the CJam interpreter. If the link doesn't work for you, copy from this paste.
Background
To obtain the electron configuration of the Nth atom, we start with an atom without electrons and apply N transformations to it.
To reduce the byte count of the implementation, we represent the electron configuration of an atom as an integer. Each digit of that integer in base 33 corresponds to the number of electrons in a certain shells; the least significant digit represents the outer shell.
For example, the electron configuration of Molybdenum (42) is [2 8 18 13 1]. This corresponds to the integer 2 × 334 + 8 × 333 + 18 × 332 + 13 × 33 + 1 = 26,79,370.
Palladium (48) is a special case, which we treat as [2 8 18 18 0] instead of [2 8 18 18].
This convenient representation reduces the aforementioned transformations to simple arithmetic:

R += 1 (add an electron to the outer shell)
R += 33 (add an electron to the second outer shell)
R += 65 (add two electrons to the second outer shell; remove one from the first)
R += 1089 (add an electron to the third outer shell)
R += 2145 (add two electrons to the third outer shell; remove one from the second)
R *= 33, R += 1 (add a new shell containing a single electron)

All that's left is to somehow encode which transformation has to be applied to pass from a particular atom to the next. The differences of the integer representations of two consecutive atoms are as follows:
[1 1 65 1 1 1 1 1 1 1 2369 1 1 1 1 1 1 1 78401 1 33 33 33 65 1 33 33 33 65 1 1 1 1 1 1 1 2598017 1 33 33 65 33 1 65 33 65 1 1 1 1 1 1 1 1 85745345 1 33 1089 2145 1089 1089 1089 1089 33 2145 1089 1089 1089 1089 1089 33 33 33 33 33 33 33 65 33 1 1 1 1 1 1 1 2830095041 1 33 33 2145 1089 1089 2145 1089 33 2145 1089 1089 1089 1089 1089 65 1 33 33 33 33 33 33 65 1 1 1 1 1 1 1]

The unique differences in this array are the following:
[1 33 65 1089 2145 2369 78401 2598017 85745345 2830095041]

All but the first 5 correspond to instances when a new shell is added; these can be omitted since multiplying by 33 and adding 1 yields the same result as adding the difference.
Since we have to add a new shell if and only if the current atom has exactly eight electrons in its outer shell (with the exception of He (2) ↦ Li (3), which can be encoded as add 65), we can encode those transformations as add 1 and determine the need for multiplication on the fly.
Thus, if we define
X := 0
I := 0
L := [33 1089 65 2145 1]
T := [1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 3 1 0 0 0 3 1 1 1 1 1 1 1 1 1 0 0 3 0 1 3 0 3 1 1 1 1 1 1 1 1 1 1 0 2 4 2 2 2 2 0 4 2 2 2 2 2 0 0 0 0 0 0 0 3 0 1 1 1 1 1 1 1 1 1 0 0 4 2 2 4 2 0 4 2 2 2 2 2 3 1 0 0 0 0 0 0 3 1 1 1 1 1 1 1]

the electron configuration of the Nth atom can be computed as follows:
while(X < N):
    R *= (33 ** (R % 33 == 8))
    R += L[T[X]]
    X += 1

How it works
" Push 0, the initial value of R; convert the following array into an integer by
  considering it a base 256 number, then back to the array of its digits in base 6.       ";

0"hTHøìð¼Ä¿håêÛ¾ªÔ¼"256b6b

" Replace each 5 in the resulting array by [4 4 4 4 4 4 4 4]. This yields the array T
  from the above section.                                                                 ";

5a/4a8**

" Read an integer N from STDIN and discard all but the first N elements of T.             ";

li<

" For each element Y of the remainder of T, do the following:                             ";

{
    [33:B_B*65_B*1]=\   " Define B := 33, push L, retrieve L[Y] and swap it with R.       ";

    _B%8=B\#*           " Execute R *= 33 ** (R % 33 == 8).                               ";

    +                   " Execute R += L[Y].                                              ";
}/

" Convert R into the array of its digits in base 33, remove eventual zeros (Palladium)
  and replace the resulting array with its string representation.                         ";

Bb0-`

Example run
$ base64 -d > electrons.cjam <<< MCJoVEgM+OzwErzEGL9o5erbvqrUB4YZhrwRIjI1NmI2YjVhLzRhOCoqbGk8e1szMzpCX0IqNjVfQioxXT1cX0IlOD1CXCMqK30vQmIwLWA=
$ cksum electrons.cjam
3709391992 80 electrons.cjam
$ for i in {1..118}; do LANG=en_US cjam electrons.cjam <<< $i; echo; done
[1]
[2]
[2 1]
[2 2]
[2 3]
[2 4]
[2 5]
[2 6]
[2 7]
[2 8]
[2 8 1]
[2 8 2]
[2 8 3]
[2 8 4]
[2 8 5]
[2 8 6]
[2 8 7]
[2 8 8]
[2 8 8 1]
[2 8 8 2]
[2 8 9 2]
[2 8 10 2]
[2 8 11 2]
[2 8 13 1]
[2 8 13 2]
[2 8 14 2]
[2 8 15 2]
[2 8 16 2]
[2 8 18 1]
[2 8 18 2]
[2 8 18 3]
[2 8 18 4]
[2 8 18 5]
[2 8 18 6]
[2 8 18 7]
[2 8 18 8]
[2 8 18 8 1]
[2 8 18 8 2]
[2 8 18 9 2]
[2 8 18 10 2]
[2 8 18 12 1]
[2 8 18 13 1]
[2 8 18 13 2]
[2 8 18 15 1]
[2 8 18 16 1]
[2 8 18 18]
[2 8 18 18 1]
[2 8 18 18 2]
[2 8 18 18 3]
[2 8 18 18 4]
[2 8 18 18 5]
[2 8 18 18 6]
[2 8 18 18 7]
[2 8 18 18 8]
[2 8 18 18 8 1]
[2 8 18 18 8 2]
[2 8 18 18 9 2]
[2 8 18 19 9 2]
[2 8 18 21 8 2]
[2 8 18 22 8 2]
[2 8 18 23 8 2]
[2 8 18 24 8 2]
[2 8 18 25 8 2]
[2 8 18 25 9 2]
[2 8 18 27 8 2]
[2 8 18 28 8 2]
[2 8 18 29 8 2]
[2 8 18 30 8 2]
[2 8 18 31 8 2]
[2 8 18 32 8 2]
[2 8 18 32 9 2]
[2 8 18 32 10 2]
[2 8 18 32 11 2]
[2 8 18 32 12 2]
[2 8 18 32 13 2]
[2 8 18 32 14 2]
[2 8 18 32 15 2]
[2 8 18 32 17 1]
[2 8 18 32 18 1]
[2 8 18 32 18 2]
[2 8 18 32 18 3]
[2 8 18 32 18 4]
[2 8 18 32 18 5]
[2 8 18 32 18 6]
[2 8 18 32 18 7]
[2 8 18 32 18 8]
[2 8 18 32 18 8 1]
[2 8 18 32 18 8 2]
[2 8 18 32 18 9 2]
[2 8 18 32 18 10 2]
[2 8 18 32 20 9 2]
[2 8 18 32 21 9 2]
[2 8 18 32 22 9 2]
[2 8 18 32 24 8 2]
[2 8 18 32 25 8 2]
[2 8 18 32 25 9 2]
[2 8 18 32 27 8 2]
[2 8 18 32 28 8 2]
[2 8 18 32 29 8 2]
[2 8 18 32 30 8 2]
[2 8 18 32 31 8 2]
[2 8 18 32 32 8 2]
[2 8 18 32 32 10 1]
[2 8 18 32 32 10 2]
[2 8 18 32 32 11 2]
[2 8 18 32 32 12 2]
[2 8 18 32 32 13 2]
[2 8 18 32 32 14 2]
[2 8 18 32 32 15 2]
[2 8 18 32 32 16 2]
[2 8 18 32 32 18 1]
[2 8 18 32 32 18 2]
[2 8 18 32 32 18 3]
[2 8 18 32 32 18 4]
[2 8 18 32 32 18 5]
[2 8 18 32 32 18 6]
[2 8 18 32 32 18 7]
[2 8 18 32 32 18 8]

An upvote for the sheer amount of effort, sir. ;)

GolfScript (96 bytes)
Output is in the form
[2 8 18 18]

This uses a magic string which contains non-printable characters, so I'm giving the script in xxd format:
0000000: 7e30 5c27 0193 ca05 528e 6b25 e461 4d12  ~0\'....R.k%.aM.
0000010: 3195 9abf c9a4 bfad 588b d876 5e72 c82a  1.......X..v^r.*
0000020: 2dd3 6e92 4940 e00b 80dc 71f6 fc97 2732  -.n.I@....q...'2
0000030: 3536 6261 7365 2037 6261 7365 3c7b 2731  56base 7base<{'1
0000040: 0a29 0a5c 295c 0a2b 310a 2b29 0a40 2940  .).\)\.+1.+).@)@
0000050: 400a 402b 5c28 3227 6e2f 3d7e 7d2f 5d60  @.@+\(2'n/=~}/]`

For online testing I'm writing the magic string with escapes:
"\x01\x93\xCA\x05R\x8Ek%\xE4aM\x121\x95\x9A\xBF\xC9\xA4\xBF\xADX\x8B\xD8v^r\xC8*-\xD3n\x92I@\xE0\v\x80\xDCq\xF6\xFC\x97"

but it's equivalent when you're not running into problems of pasting characters into browser textareas.
The approach is to build a virtual machine with 7 instructions, each of which manipulates a list of electron counts. Then for element n we start with an electron count list of 0 and run the first n instructions from the list encoded by the magic string.
The instructions are:

Add a new shell with 1 electron: 1
Add an electron to the outer shell: )
Add an electron to the next-to-outer shell: \)\
Combine the two outer shells and add one electron: +). (This is used only for palladium).
Combine the two outer shells and create a new shell with 1 electron: +1
Add an electron to the third shell in: @)@@
Add an electron to the third shell and move one from the second shell to the third shell. This only occurs when the outer shell has 2 electrons, so it's implemented as @+\(2 rather than the longer @2+@(@

What are your 7 instructions?

Ah. Thanks. I guess I'm going to need to pick up one of these esoteric golfing languages in order to win a golf challenge one of these days. I had a heck of a time writing compact code that could interpret two instructions, let alone seven. :P

Do I provide input on STDIN? (and then it appears on the stack)?

@professorfish: Yes. GolfScript automatically places the input from STDIN on the stack.

Python 2 (46+271=327)
Code:
print open('f').read().decode('zip').split(';')[input()]

File f, containing the following binary garbage (these are the char codes)
120, 156, 101, 146, 219, 21, 195, 32, 12, 67, 87, 233, 8, 193, 188, 204, 201, 254, 123, 21, 40, 46, 146, 253, 65, 163, 171, 10, 98, 199, 188, 233, 149, 87, 62, 243, 247, 179, 158, 121, 174, 50, 87, 157, 171, 205, 213, 231, 210, 181, 118, 66, 119, 70, 119, 74, 119, 78, 119, 82, 119, 86, 127, 233, 147, 183, 29, 182, 103, 156, 103, 122, 76, 36, 19, 249, 68, 167, 56, 78, 49, 81, 77, 52, 19, 118, 110, 210, 235, 100, 19, 197, 68, 53, 209, 76, 116, 19, 250, 23, 247, 36, 56, 107, 192, 139, 30, 208, 114, 211, 183, 96, 172, 121, 87, 123, 253, 6, 90, 175, 66, 23, 118, 66, 15, 216, 6, 118, 130, 205, 96, 63, 216, 18, 119, 197, 141, 185, 222, 6, 146, 36, 76, 138, 16, 101, 162, 66, 84, 29, 225, 153, 157, 254, 163, 90, 100, 32, 229, 135, 136, 106, 201, 226, 104, 16, 225, 136, 22, 38, 70, 97, 204, 140, 133, 177, 50, 246, 251, 33, 23, 170, 71, 97, 204, 140, 133, 177, 50, 54, 198, 206, 168, 14, 253, 155, 195, 187, 135, 55, 220, 103, 145, 199, 69, 230, 188, 157, 225, 63, 44, 207, 121, 25, 53, 26, 110, 75, 247, 9, 95, 170, 27, 187, 248, 201, 75, 28, 126, 152, 255, 111, 232, 41, 56, 62, 147, 130, 35, 193, 201, 193, 41, 193, 169, 193, 105, 193, 209, 80, 79, 172, 153, 111, 72, 188, 36, 241, 158, 196, 171, 18, 111, 203, 185, 16, 95, 151, 67, 8, 97

Base64:
eJxlktsVwyAMQ1fpCMG8zMn+exUoLpL9QaOrCmLHvOmVVz7z97Oeea4yV52rzdXn0rV2QndGd0p3
TndSd1Z/6ZO3HbZnnGd6TCQT+USnOE4xUU00E3Zu0utkE8VENdFMdBP6F/ckOGvAix7QctO3YKx5
V3v9BlqvQhd2Qg/YBnaCzWA/2BJ3xY253gaSJEyKEGWiQlQd4Zmd/qNaZCDlh4hqyeJoEOGIFiZG
YcyMhbEy9vshF6pHYcyMhbEyNsbOqA79m8O7hzfcZ5HHRea8neE/LM95GTUabkv3CV+qG7v4yUsc
fpj/b+gpOD6TgiPBycEpwanBacHRUE+smW9IvCTxnsSrEm/LuRBfl0MIYQ==

On request, this is now a full program rather than a function.
Old answer: Python (Naive baseline, 422):
f=lambda n:'eJxlktsVwyAMQ1fpCMG8zMn+exUoLpL9QaOrCmLHvOmVVz7z97Oeea4yV52rzdXn0rV2QndGd0p3TndSd1Z/6ZO3HbZnnGd6TCQT+USnOE4xUU00E3Zu0utkE8VENdFMdBP6F/ckOGvAix7QctO3YKx5V3v9BlqvQhd2Qg/YBnaCzWA/2BJ3xY253gaSJEyKEGWiQlQd4Zmd/qNaZCDlh4hqyeJoEOGIFiZGYcyMhbEy9vshF6pHYcyMhbEyNsbOqA79m8O7hzfcZ5HHRea8neE/LM95GTUabkv3CV+qG7v4yUscfpj/b+gpOD6TgiPBycEpwanBacHRUE+smW9IvCTxnsSrEm/LuRBfl0MIYQ=='.decode('base64').decode('zip').split(';')[n]

Contents of the zip:
>>>'eJxlktsVwyAMQ1fpCMG8zMn+exUoLpL9QaOrCmLHvOmVVz7z97Oeea4yV52rzdXn0rV2QndGd0p3TndSd1Z/6ZO3HbZnnGd6TCQT+USnOE4xUU00E3Zu0utkE8VENdFMdBP6F/ckOGvAix7QctO3YKx5V3v9BlqvQhd2Qg/YBnaCzWA/2BJ3xY253gaSJEyKEGWiQlQd4Zmd/qNaZCDlh4hqyeJoEOGIFiZGYcyMhbEy9vshF6pHYcyMhbEyNsbOqA79m8O7hzfcZ5HHRea8neE/LM95GTUabkv3CV+qG7v4yUscfpj/b+gpOD6TgiPBycEpwanBacHRUE+smW9IvCTxnsSrEm/LuRBfl0MIYQ=='.decode('base64').decode('zip')
';1;2;2 1;2 2;2 3;2 4;2 5;2 6;2 7;2 8;2 8 1;2 8 2;2 8 3;2 8 4;2 8 5;2 8 6;2 8 7;2 8 8;2 8 8 1;2 8 8 2;2 8 9 2;2 8 10 2;2 8 11 2;2 8 13 1;2 8 13 2;2 8 14 2;2 8 15 2;2 8 16 2;2 8 18 1;2 8 18 2;2 8 18 3;2 8 18 4;2 8 18 5;2 8 18 6;2 8 18 7;2 8 18 8;2 8 18 8 1;2 8 18 8 2;2 8 18 9 2;2 8 18 10 2;2 8 18 12 1;2 8 18 13 1;2 8 18 13 2;2 8 18 15 1;2 8 18 16 1;2 8 18 18;2 8 18 18 1;2 8 18 18 2;2 8 18 18 3;2 8 18 18 4;2 8 18 18 5;2 8 18 18 6;2 8 18 18 7;2 8 18 18 8;2 8 18 18 8 1;2 8 18 18 8 2;2 8 18 18 9 2;2 8 18 19 9 2;2 8 18 21 8 2;2 8 18 22 8 2;2 8 18 23 8 2;2 8 18 24 8 2;2 8 18 25 8 2;2 8 18 25 9 2;2 8 18 27 8 2;2 8 18 28 8 2;2 8 18 29 8 2;2 8 18 30 8 2;2 8 18 31 8 2;2 8 18 32 8 2;2 8 18 32 9 2;2 8 18 32 10 2;2 8 18 32 11 2;2 8 18 32 12 2;2 8 18 32 13 2;2 8 18 32 14 2;2 8 18 32 15 2;2 8 18 32 17 1;2 8 18 32 18 1;2 8 18 32 18 2;2 8 18 32 18 3;2 8 18 32 18 4;2 8 18 32 18 5;2 8 18 32 18 6;2 8 18 32 18 7;2 8 18 32 18 8;2 8 18 32 18 8 1;2 8 18 32 18 8 2;2 8 18 32 18 9 2;2 8 18 32 18 10 2;2 8 18 32 20 9 2;2 8 18 32 21 9 2;2 8 18 32 22 9 2;2 8 18 32 24 8 2;2 8 18 32 25 8 2;2 8 18 32 25 9 2;2 8 18 32 27 8 2;2 8 18 32 28 8 2;2 8 18 32 29 8 2;2 8 18 32 30 8 2;2 8 18 32 31 8 2;2 8 18 32 32 8 2;2 8 18 32 32 10 1;2 8 18 32 32 10 2;2 8 18 32 32 11 2;2 8 18 32 32 12 2;2 8 18 32 32 13 2;2 8 18 32 32 14 2;2 8 18 32 32 15 2;2 8 18 32 32 16 2;2 8 18 32 32 18 1;2 8 18 32 32 18 2;2 8 18 32 32 18 3;2 8 18 32 32 18 4;2 8 18 32 32 18 5;2 8 18 32 32 18 6;2 8 18 32 32 18 7;2 8 18 32 32 18 8'
>>>len(_)
1478

And a quick test:
map(f, range(119))
Out[48]:
['',
 '1',
 '2',
 '2 1',
 '2 2',
 '2 3',
 '2 4',
 '2 5',
 '2 6',
 '2 7',
 '2 8',
 '2 8 1',
 '2 8 2',
 '2 8 3',
 '2 8 4',
 '2 8 5',
 '2 8 6',
 '2 8 7',
 '2 8 8',
 '2 8 8 1',
 '2 8 8 2',
 '2 8 9 2',
 '2 8 10 2',
 '2 8 11 2',
 '2 8 13 1',
 '2 8 13 2',
 '2 8 14 2',
 '2 8 15 2',
 '2 8 16 2',
 '2 8 18 1',
 '2 8 18 2',
 '2 8 18 3',
 '2 8 18 4',
 '2 8 18 5',
 '2 8 18 6',
 '2 8 18 7',
 '2 8 18 8',
 '2 8 18 8 1',
 '2 8 18 8 2',
 '2 8 18 9 2',
 '2 8 18 10 2',
 '2 8 18 12 1',
 '2 8 18 13 1',
 '2 8 18 13 2',
 '2 8 18 15 1',
 '2 8 18 16 1',
 '2 8 18 18',
 '2 8 18 18 1',
 '2 8 18 18 2',
 '2 8 18 18 3',
 '2 8 18 18 4',
 '2 8 18 18 5',
 '2 8 18 18 6',
 '2 8 18 18 7',
 '2 8 18 18 8',
 '2 8 18 18 8 1',
 '2 8 18 18 8 2',
 '2 8 18 18 9 2',
 '2 8 18 19 9 2',
 '2 8 18 21 8 2',
 '2 8 18 22 8 2',
 '2 8 18 23 8 2',
 '2 8 18 24 8 2',
 '2 8 18 25 8 2',
 '2 8 18 25 9 2',
 '2 8 18 27 8 2',
 '2 8 18 28 8 2',
 '2 8 18 29 8 2',
 '2 8 18 30 8 2',
 '2 8 18 31 8 2',
 '2 8 18 32 8 2',
 '2 8 18 32 9 2',
 '2 8 18 32 10 2',
 '2 8 18 32 11 2',
 '2 8 18 32 12 2',
 '2 8 18 32 13 2',
 '2 8 18 32 14 2',
 '2 8 18 32 15 2',
 '2 8 18 32 17 1',
 '2 8 18 32 18 1',
 '2 8 18 32 18 2',
 '2 8 18 32 18 3',
 '2 8 18 32 18 4',
 '2 8 18 32 18 5',
 '2 8 18 32 18 6',
 '2 8 18 32 18 7',
 '2 8 18 32 18 8',
 '2 8 18 32 18 8 1',
 '2 8 18 32 18 8 2',
 '2 8 18 32 18 9 2',
 '2 8 18 32 18 10 2',
 '2 8 18 32 20 9 2',
 '2 8 18 32 21 9 2',
 '2 8 18 32 22 9 2',
 '2 8 18 32 24 8 2',
 '2 8 18 32 25 8 2',
 '2 8 18 32 25 9 2',
 '2 8 18 32 27 8 2',
 '2 8 18 32 28 8 2',
 '2 8 18 32 29 8 2',
 '2 8 18 32 30 8 2',
 '2 8 18 32 31 8 2',
 '2 8 18 32 32 8 2',
 '2 8 18 32 32 10 1',
 '2 8 18 32 32 10 2',
 '2 8 18 32 32 11 2',
 '2 8 18 32 32 12 2',
 '2 8 18 32 32 13 2',
 '2 8 18 32 32 14 2',
 '2 8 18 32 32 15 2',
 '2 8 18 32 32 16 2',
 '2 8 18 32 32 18 1',
 '2 8 18 32 32 18 2',
 '2 8 18 32 32 18 3',
 '2 8 18 32 32 18 4',
 '2 8 18 32 32 18 5',
 '2 8 18 32 32 18 6',
 '2 8 18 32 32 18 7',
 '2 8 18 32 32 18 8']

This is good, but please make it a complete program (that reads in input from stdin or arguments); also, you can use an external file to avoid the base64 (but the file and its name count towards code length)

The answer you link to begins with Unless the question is an obvious exception (the primary exception being those tagged kolmogorov-complexity), which is the case here. The whole idea of kolmogorov-complexity questions is to hardcode the output in the most efficient manner.

I missed the kolmogorov-complexity tag. And here I am trying to decipher the energy levels of the various valence subshells, and I'm not even a physicist. :I

The "old answer" only works in Python2. I haven't checked the new one - have you got a base64 of the file f so I can reproduce it?

@professorfish Most certainly. The new one is also python 2 only (print as a keyword rather than a function).

You could save 3 chars by encoding each result with dashes instead of spaces (2-8-13-2) and separating the elements spaces instead of semicolons, then you do .split() instead of .split(';')

And if Python has libraries for gzip, then not only can you use gzip (which is more efficient), but standard gzip tools can decompress files created by zopfli, which is even more efficient

@professorfish Python probably has libraries for gzip, but the strength of Python in this case it that it's strs have an buit in decode method, that can decode zip without having to use any external modules. This isn't true for gzip (unless the builtin method also accepts gzip, I haven't tested that), so I think that would probably add characters rather than remove them. Still, thanks for the advice.

MATLAB - 248 244 241 178 + 44 = 222 bytes
Minified:
i=1;a=fread(fopen('a'));b=fix(a/7);a=a-7*b+1;d=0*a;for n=1:input(''),A=a(i);if b(i),m=1;i=i+(d(A)+2>b(i));else A=A-[1;0];m=[2;-1];i=i+1;end;d(A)=d(A)+m;end;fprintf('%d ',d(~~d));

Expanded:
i = 1;
a = fread( fopen( 'a' ) );
b = fix( a/7 );
a = a-7*b+1;
d = 0*a;
for n = 1:input('')
    A = a(i);
    if b(i)
        m = 1;
        i = i + (d(A)+2 > b(i));
    else
        A = A - [1; 0];
        m = [2; -1];
        i = i + 1;
    end
    d(A) = d(A) + m;
end
fprintf( '%d ', d(~~d) );

Binary File Dependency (Filename 'a'):
0e 39 3a 11  4f 03 72 03  3b 12 49 04  5e 12 04 73
04 3c 13 43  88 04 b2 43  04 e3 6d 05  82 3d 14 4b
05 9e 05 b3  44 05 e4 06  14 75 06 3e

I trust this is a "complete program" in that it can be invoked from the commandline, it reads from stdin and outputs to stdout.
It uses a kind of two-instruction bytecode to build the electron configurations. The two instructions are
inc D until N      (i.e. increment valence D by 1; advance to next instruction when D = N)

and
pulldown D         (i.e. pull down one electron from valence D, thereby decrementing it by 1
                         and incrementing valence D-1 by 2)

The instructions are encoded in two arrays. The first stores the D argument in all cases. The second stores the N argument or 0 to indicate a pulldown instruction, since N = 0 is never used as an argument.
The complete sequence of instructions is:
inc 1 until 2
inc 2 until 8
inc 3 until 8
inc 4 until 2
inc 3 until 11
pulldown 4

inc 3 until 16
pulldown 4

inc 4 until 8
inc 5 until 2
inc 4 until 10
pulldown 5

inc 4 until 13
inc 5 until 2
pulldown 5

inc 4 until 16
pulldown 5

inc 5 until 8
inc 6 until 2
inc 5 until 9
inc 4 until 19
pulldown 5

inc 4 until 25
inc 5 until 9
pulldown 5

inc 4 until 32
inc 5 until 15
pulldown 6

inc 5 until 18
inc 6 until 8
inc 7 until 2
inc 6 until 10
pulldown 6

inc 5 until 22
pulldown 6

inc 5 until 25
inc 6 until 9
pulldown 6

inc 5 until 32
pulldown 7

inc 7 until 2
inc 6 until 16
pulldown 7

inc 7 until 8

It's worth noting that 28 characters can be dropped if we use the MATLAB-specific character set, but I wanted my solution to be representable as plaintext on Stack Exchange, without any external file references.
External file references it is.
Sample Outputs
39: 2 8 18 9 2
78: 2 8 18 32 17 1
117: 2 8 18 32 32 18 7
5: 2 3

How do I reconstruct the "binary file dependency"?

The file is the 44 byte codes I have listed, left-to-right, top-to-bottom in the usual order. The filename is simply "a", without extension. It needs to be in the working directory when the script is run. I've uploaded a downloadable copy to http://syonidv.hodginsmedia.com/misc/a

CJam, 309 289 bytes
0000000: 22 cc b5 a3 1a f7 bd 07 1b 26 ce 73 16 55 87 08  "........&.s.U..
0000010: 27 d2 65 54 66 ac c1 38 ff de 95 d8 8a 77 6d 4e  '.eTf..8.....wmN
0000020: 0d 13 df bb b7 c6 8c ae 6b 32 4d b9 f1 7c b9 f1  ........k2M..|..
0000030: bc 68 2d 8a 5c 22 e6 5c 22 e1 d7 c9 80 ba a5 5d  .h-.\".\"......]
0000040: 64 24 47 0b aa 78 c9 13 a5 0a 65 41 08 f3 ee e3  d$G..x....eA....
0000050: 2e 58 92 19 5f 1a 80 fc d9 30 3b 51 99 c7 1b 51  .X.._....0;Q...Q
0000060: ba 0c 8a 3c 7d f0 60 1e d5 1c e7 2f 33 16 c8 1f  ...<}.`..../3...
0000070: e6 df 24 75 d1 51 e6 af 38 b4 f7 b1 63 77 14 8d  ..$u.Q..8...cw..
0000080: d3 69 bc 99 9e a5 98 56 53 e7 71 f7 48 76 7a 24  .i.....VS.q.Hvz$
0000090: a7 dc 5c 22 fc a6 55 05 30 e2 03 d6 a8 ef 1a 9f  ..\"..U.0.......
00000a0: e4 03 c6 a0 5e 60 be 01 2b ca 12 83 d4 64 69 3d  ....^`..+....di=
00000b0: a7 2e cc 59 5e 0c bb 69 b0 19 1d e1 f2 53 e4 1b  ...Y^..i.....S..
00000c0: 6e 6d cc 45 d3 1f cc 3c b7 1b 5f ca c8 d0 94 fe  nm.E...<.._.....
00000d0: 05 ea ae dc 98 9e 9a 47 a6 fa 3a 0e c3 45 ef 31  .......G..:..E.1
00000e0: 61 a0 7c 80 55 9a 5d 7a af 8e 51 e8 5c 79 c4 22  a.|.U.]z..Q.\y."
00000f0: 32 35 36 62 33 38 62 22 24 12 23 20 5c 22 12 21  256b38b"$.# \".!
0000100: 08 00 02 22 3a 69 32 2f 7b 5f 30 3d 5f 29 33 33  ...":i2/{_0=_)33
0000110: 3f 61 40 5c 2f 5c 2a 7d 2f 30 61 2f 6c 69 28 3d  ?a@\/\*}/0a/li(=
0000120: 60                                               <

Works by replacing common runs (e.g., 2 8 18 32) with integers greater than 32 and considering the array of all configurations a base 38 number, which is encoded in binary.
Example run
$ base64 -d > electrons.cjam <<< Isy1oxr3vQcbJs5zFlWHCCfSZVRmrME4/96V2Ip3bU4NE9+7t8aMrmsyTbnxfLnxvGgtilwi5lwi4dfJgLqlXWQkRwuqeMkTpQplQQjz7uMuWJIZXxqA/NkwO1GZxxtRugyKPH3wYB7VHOcvMxbIH+bfJHXRUeavOLT3sWN3FI3TabyZnqWYVlPncfdIdnokp9xcIvymVQUw4gPWqO8an+QDxqBeYL4BK8oSg9RkaT2nLsxZXgy7abAZHeHyU+Qbbm3MRdMfzDy3G1/KyNCU/gXqrtyYnppHpvo6DsNF7zFhoHyAVZpdeq+OUehcecQiMjU2YjM4YiIkEiMgXCISIQgAAiI6aTIve18wPV8pMzM/YUBcL1wqfS8wYS9saSg9YA==
$ cksum electrons.cjam
3109698089 289 electrons.cjam
$ LANG=en_US cjam electrons.cjam <<< 42; echo
[2 8 18 13 1]
$ for i in {1..118}; do LANG=en_US cjam electrons.cjam <<< $i; echo; done | md5sum
d09cb34c282ee52c2466a6b80aa30d22  -

Perl 5, 235 (234 + 1 for -E)
Golfed:
@a=unpack'C*','ABR3S4sT5tU6';if(($-=<>)~~[unpack'C*',')*,-./9:@NOYZ[\]`g']){$.+=($-~~[46,90]);$p=2+$-/33;$->87|$-~~[57..64]&&($.*=-1);$o[$p]+=$.,$o[$p+1]-=$.}$%=($%=$a[$q]/8)>$-?$-:$%,$o[$a[$q++]&7]+=$%while($--=$%);$,=$";say@o

Note: a hex dump is provided at the bottom of this post, as some of the string literals contain control characters (which were entered through a hex editor).
Ungolfed with comments:

$_=<>;
# For each byte, the first 5 bits are the number of spaces to fill at a time, the next 3 bits represent the shell number, minus 1.
# Values: 10 41 42 13 52 33 14 53 34 15 73 54 35 16 74 55 36
# The 1st shell takes 2 electrons
# Then the 2nd shell take 8, then the third takes 8...
@a=unpack'C*','ABR3S4sT5tU6';
# Contains the atomic numbers of abnormal elements
# Values: 18 1d 29 2a 2c 2d 2e 2f 39 3a 40 4e 4f 59 5a 5b 5c 5d 60 67
@b=unpack'C*',')*,-./9:@NOYZ[\]`g';
# if abnormal
if($_~~@b){
    # All abnormals, except element 46 and 90, only displace 1 electron
    $y=1+($_~~[46,90]);
    # Abnormals with atomic number less than 33 involve switches between shells 3 and 4
    # 33-65: 4 and 5
    # 66-98: 5 and 6
    # 99+ : 6 and 7
    $p = (3 + ~~($_/33)) - 1;
    # abnormals in these ranges move electrons from lower to higher
    # abnormals elsewhere do higher to lower
    if($_ >= 88 || $_ ~~ [57..64]){
        $y *= -1;
    }
    # move electrons
    $o[$p] += $y;
    $o[$p+1] -= $y;
}

    # extract max number of electrons to fill shell with
    # >> 3 is equivalent to /8 for integers; $% is always an integer.
    $% = $a[$q] / 8,
    # do not overfill
    $% = $% > $_ ? $_ : $%,
    # add electrons to shell
    $o[ $a[$q++] & 7 ] += $%
# reduce number of electrons left to fill shells with
while($_ -= $%);
# set list separator to space
$, = $";
# print list representing shells
say @o

Hex Dump:
0000000: 4061 3d75 6e70 6163 6b27 432a 272c 2710  @a=unpack'C*','.
0000010: 4142 1352 3314 5334 1573 5435 1674 5536  AB.R3.S4.sT5.tU6
0000020: 273b 6966 2828 242d 3d3c 3e29 7e7e 5b75  ';if(($-=<>)~~[u
0000030: 6e70 6163 6b27 432a 272c 2718 1d29 2a2c  npack'C*','..)*,
0000040: 2d2e 2f39 3a40 4e4f 595a 5b5c 5d60 6727  -./9:@NOYZ[\]`g'
0000050: 5d29 7b24 2e2b 3d28 242d 7e7e 5b34 362c  ]){$.+=($-~~[46,
0000060: 3930 5d29 3b24 703d 322b 242d 2f33 333b  90]);$p=2+$-/33;
0000070: 242d 3e38 377c 242d 7e7e 5b35 372e 2e36  $->87|$-~~[57..6
0000080: 345d 2626 2824 2e2a 3d2d 3129 3b24 6f5b  4]&&($.*=-1);$o[
0000090: 2470 5d2b 3d24 2e2c 246f 5b24 702b 315d  $p]+=$.,$o[$p+1]
00000a0: 2d3d 242e 7d24 253d 2824 253d 2461 5b24  -=$.}$%=($%=$a[$
00000b0: 715d 2f38 293e 242d 3f24 2d3a 2425 2c24  q]/8)>$-?$-:$%,$
00000c0: 6f5b 2461 5b24 712b 2b5d 2637 5d2b 3d24  o[$a[$q++]&7]+=$
00000d0: 2577 6869 6c65 2824 2d2d 3d24 2529 3b24  %while($--=$%);$
00000e0: 2c3d 2422 3b73 6179 406f                 ,=$";say@o

How do I reverse the hexdump? (It's probably better to either do a reversible xxd dump or a base64)

@professorfish reversible xxd dump added


text:
Pigpen Cipher Encryption
Pigpen Cipher Encryption
Your mission is simple: to write a program which receives text as input and outputs an ASCII representation of it in the Pigpen Cipher.
Input
ASCII-only (no Unicode) characters. You must be able to handle at least 16384 characters and 256 lines.
Output

Replace all characters which are not new lines or in ABCDEFGHIJKLMNOPQRSTUVWXYZ or abcdefghijklmnopqrstuvwxyz with spaces.
Case-insensitively, replace each letter with its encrypted form (see next section), inserting a trailing space on each of the three lines after each. Each encoded character is a 3*3 block of ASCII art. Replace spaces with 3*3 blocks of spaces.
All the characters should be on the same three lines (call these three lines one pigpen-line), unless there is a new line, which starts a new pigpen-line. Leave a normal line blank between pigpen-lines.

The Cipher
  |       | |       |
 .|       |.|       |.
--+ for J +-+ for K +-- for L

--+       +-+       +--
 .|       |.|       |.
--+ for M +-+ for N +-- for O

--+       +-+       +--
 .|       |.|       |.
  | for P | | for Q |   for R

(ABCDEFGHI are the same as JKLMNOPQR, but with the . replaced by a space)

\./
 V  for W (note the row of 3 spaces on the top)

 ^
/.\ for Z (note the 3 spaces on the bottom)

 \
 .>
 /  for X (note the leading spaces)

 /
<.
 \  for Y (note extra trailing spaces)

(STUV are like WXYZ, but with the . replaced by a space)

Example
The input "hEllo,wORLd" should produce:
+-+ +-+ |   |   +--         +-- +-- |   --+
| | | | |.  |.  |.      \./ |.  |.  |.    |
| | +-+ +-- +-- +--      V  +-- |   +-- --+

The base64 encoding of the above, with a trailing new line, is below. The md5sum is 6f8ff1fed0cca4dd0492f9728ea02e7b.
Ky0rICstKyB8ICAgfCAgICstLSAgICAgICAgICstLSArLS0gfCAgIC0tKwp8IHwgfCB8IHwuICB8
LiAgfC4gICAgICBcLi8gfC4gIHwuICB8LiAgICB8CnwgfCArLSsgKy0tICstLSArLS0gICAgICBW
ICArLS0gfCAgICstLSAtLSsK

Without a trailing new line, the md5sum is 581005bef7ee76e24c019d076d5b375f and the base64 is:
Ky0rICstKyB8ICAgfCAgICstLSAgICAgICAgICstLSArLS0gfCAgIC0tKwp8IHwgfCB8IHwuICB8

LiAgfC4gICAgICBcLi8gfC4gIHwuICB8LiAgICB8CnwgfCArLSsgKy0tICstLSArLS0gICAgICBW
ICArLS0gfCAgICstLSAtLSs=
Rules

Standard loopholes are forbidden.
This is code golf. Shortest code wins.
In languages which cannot accept multiple lines of input at a time (e.g. JavaScript with prompt()), use * (or some other character) as a line separator.

Erranda

The example was missing a few spaces (A space should consist of the trailing spaces of the previous character, if any, itself, and its own trailing spaces). This has now been fixed.

I remember playing with this as a kid, but never knew the name of it. Thanks!

Can I use a custom font?  :-)

@FlorianF No...

Coding in javascript. Usually prompt is used for input, but it accepts a single line only. Could I use a special char (like '*') to mark a new line in input?.

@edc65 Yes, you may

As pointed out by Claudiu, there are 4 spaces between Hello and World in your example. If I render a space as 3x3 chars block and add 1 space before and 1 space after, I get 5 spaces between words. Am I wrong?

@edc65 no you aren't, thanks

@edc65 please edit it in

Next up: Run all the answers through themselves, whichever has the least spaces in it wins.

@professorfish: could you add md5s for the output if there are 5 spaces between words? I had that at first and had to add a few chars to handle 4 spaces.

@Claudiu I've fixed it

JavaScript (ES6) 312 327 340 372 446
Not counting indentation white space and newlines - could be golfed more.
Using an '*' to mark new lines in input, as prompt accepts a single line.
console.log(prompt().split('*').map(s=>
  [0,1,2].map(r=>
  [...s].map(c=>o+=n+
    '   \\1/ \\ /1\\ /  V  ^  1><1 --++-++-- 1||1||1 '.substr(
    (c=(32|c.charCodeAt())-97)<0|c>25?0:c<18
     ?27+3*'330441552030141252033144255'[f=8,c%9*3+r]
     :3*'482630015274'[f=21,c%4*3+r],3,n=' ')
  .replace(1,' .'[r&c>f])
  ,n='\n'),o=''
)&&o).join('\n'))

Test in FireFox/FireBug console
Input: ABCDEFGHI*JKLMNOPQR*STUV*WXYZ*HeLlO WoRlD!
  | | | |   --+ +-+ +-- --+ +-+ +--
  | | | |     | | | |     | | | |
--+ +-+ +-- --+ +-+ +--   | | | |

  | | | |   --+ +-+ +-- --+ +-+ +--
 .| |.| |.   .| |.| |.   .| |.| |.
--+ +-+ +-- --+ +-+ +--   | | | |

     \   /   ^
\ /   > <   / \
 V   /   \

     \   /   ^
\./  .> <.  /.\
 V   /   \

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

You have 5 spaces between the o and w in "Hello world", the OP only has 4

@Claudiu each character (even blank, char 32) 3 spaces, separator between chars 1 space. 1+3+1 == 5. I'll check with OP

Yea it definitely makes more sense with 5. I thought he specifically wanted 4 as a special-case, but good thing you asked!

C# - 921 720
Obviously not a winning entry, but this looked like too much fun to pass off :)
Program takes input as a single, then prints the pigpen. To input multiple lines, use an underscore (_) as seen in output.
Code
using System;class P{static void Main(){
int i,y,j,k,w,z;string[]g=Console.ReadLine().ToLower().Split('_');
var d="_________  |b .|b--+_| |b|.|b+-+_|  b|. b+--_--+b .|b--+_+-+b|.|b+-+_+--b|. b+--_--+b .|b  |_+-+b|.|b| |_+--b|. b|  _____   b\\./b v _ \\ b .>b / _ / b<. b \\ _ ^ b/.\\b   _  b  b  ".Replace('b','\n').Split('_');
for(i=0;i<d.Length;i++){if(d[i]==""){d[i]=i<17?d[i+9]:d[i+4];d[i]=d[i].Replace('.',' ');}}
for(y=0;y<g.Length;y++){string o="",s,e=g[y];var r=new string[z=e.Length][];
for(i=0;i<z;i++){if(e[i]-97<0|e[i]-97>25)e=e.Replace(e[i],'{');
o+=d[e[i]-97]+'_';r[i]=(o.Split('_')[i].Split('\n'));}
for(j=0;j<3;j++)for(k=0;k<(w=r.Length);k++){
s=r[k][j];Console.Write(k==w-1?s+'\n':s+' ');}}
Console.ReadLine();}}

Concept
The cipher uses a some character sequences that get duplicated quite a bit.
For example, '--' shows up 16 times and '__' (two spaces) shows up 20 times. I replace these sequences with single-character symbols and switch them out at runtime, cutting the number of characters needed to store the pigpen cipher in half. Similarly, a newline usually requires two characters, but is replaced by a symbol (n) and switched out later.
The program handles multiple lines of input by splitting the input into an array where each element is a single line of input. The program then simply runs the cipher on each line separately.
This is my first golf in any language, so there is probably a lot that can be done to improve this code.
Output
hEllo,wORLd
+-+ +-+ |   |   +--        +-- +-- |   --+
| | | | |.  |.  |.     \./ |.  |.  |.    |
| | +-+ +-- +-- +--     v  +-- |   +-- --+

code_golf
|   +-- --+ +-+
|   |.    | | |
+-- +-- --+ +-+
--+ +-- |   +--
  | |.  |.  |
  | +-- +-- +--

multi_line_input
--+  /  |    \  +--
 .| <   |.    > |
--+  \  +--  /  |
|   +-- +-+ +-+
|.  |   |.| | |
+-- |   +-+ +-+
+-- +-+ --+  /   \
|   |.|  .| <     >
|   +-+   |  \   /

I don't know C#, but there appears to be an unnecessary space in for(int i=0;i<p.Length; i++) (near the middle)

Thanks professorfish, there was another one I missed as well

In m♥lti \n lin♣e \n input, my phone renders that as having a heart instead of u in multi, and a club between the n and the e in line. Why is that?

@BetaDecay I think it is intended, to show the handling of low ASCII chars

The heart and club were put there to demonstrate compliance with the challenges' rule : Replace all characters which are not new lines or in ABCDEFGHIJKLMNOPQRSTUVWXYZ or abcdefghijklmnopqrstuvwxyz with spaces

You have 5 spaces between the o and w in "Hello world", the OP only has 4

Thanks for pointing that out Claudiu, it's fixed it now.

Maybe you fixed it too early, see new comments above

Python 2, 180 + 78 + 1 + 3 = 262 characters
The 180-byte program (last two newlines are tabs):
L=open('f','rb').read().decode('zip')
while 1:
 n=raw_input()
 for s in(0,3,6):
    for c in n:w=ord(c.lower())-97;print''.join(L[w+(s+i)*26]for i in(0,1,2))if-1<w<27 else'  ',
    print

Requires a 78-byte file called 'f' to be same directory (+1 byte for filename), which contains the following:
$ hexdump f
0000000 9c78 a853 d1a9 d6d5 2206 3805 0103 c174
0000010 c100 8b88 07d1 9ae1 051a 4ab0 385d ae03
0000020 2803 8a82 3a80 406c ae18 0f42 6006 0c1c
0000030 0a2d 31fa 6076 ee8c a030 0e14 2987 8428
0000040 7501 3080 c39a 5a10 0014 21c7 7333
000004e

The base64 encoding of file f is:
eJxTqKnR1dYGIgU4AwF0wQDBiIvRB+GaGgWwSl04A64DKIKKgDpsQBiuQg8GYBwMLQr6MXZgjO4w
oBQOhykohAF1gDCawxBaFADHITNz

The program exits with an exception, 2>_ suppresses the error (+3 bytes):
$ echo "hEllo,wORLd" | python pigpen.py 2>_| ./md5.py
7ed49b7013a30cc3e84aa807f6585325

Explanation:
I created a look-up table, L, which is a mapping of {position_in_3x3_block: {letter_being_encrypted: symbol_for_letter_at_position}}, stored in a flat array. The program prints the letters by doing a simple look-up for each position.

You should add one byte for f and three bytes for 2>_

Perl 5 -lF, 297 288 261 231 bytes
$,=$";$_=' .||.||. ';chomp@F;map{@r=/.../g;say map{/[a-z]/i?$r[-65+ord uc]:$"x3}@F}(y/./ /r.y/.| /-+-/r x2)x2 .'    \\  /  ^ 'x2,y/./ /r x3 .$_ x3 .'\\ /  ><  / \\\\./ .><. /.\\',(y/.| /-+-/r x2 .y/./ /r)x2 .' V  /  \\    'x2;say''

Try it online!
There's probably still a bit here that could be golfed further.

Vyxal j, 139 bytes
⇧×/ƛƛkAnc[C83<[»ƛ_F∆a⋎⁺^9⟨C¨¼ḢO[½ċeẇɽ»`| -+`τ9/nC⇩9%inC73>[4\.Ȧ]|`   \ / V  ^ / \    \   > /  / <   \ `4/nC›4%inC86>[4\.Ȧ]]|ð9*]3/;ÞTvṄ¤J;f

Try it Online!
What. A.  Mess.

source: Stack Exchange

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

authors: รณชัย ทนธรรม

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

sort: votes


text:
Write a Clem interpreter
Clem is a minimal stack-based programming language featuring first-class functions. Your objective is to write an interpreter for the Clem language. It should properly execute all examples included in the reference implementation, which is available here.

As usual, standard loopholes apply.
Smallest entry by byte count wins.

The Clem language
Clem is a stack based programming language with first-class functions. The best
way to learn Clem is to run the clem interpreter with no arguments. It will
start in interactive mode, allowing you to play with the available commands. To
run the example programs, type clem example.clm where example is the name of
the program. This brief tutorial should be enough to get you started.
There are two main classes of functions.  Atomic functions and compound
functions. Compound functions are lists composed of other compound functions and
atomic functions. Note that a compound function cannot contain itself.
Atomic Functions
The first type of atomic function is the constant. A constant is simply an
integer value. For example, -10. When the interpreter encounters a constant,
it pushes it to the stack. Run clem now. Type -10 at the prompt. You should
see
> -10
001: (-10)
>

The value 001 describes the position of the function in the stack and (-10)  is the constant you just entered. Now enter +11 at the prompt. You should see
> +11
002: (-10)
001: (11)
>

Notice that (-10) has moved to the second position in the stack and (11) now
occupies the first. This is the nature of a stack! You will notice that - is also the decrement command. Whenever - or + precede a number, they denote the sign of that number and not the corresponding command. All other atomic functions are commands. There are 14 in total:
@  Rotate the top three functions on the stack
#  Pop the function on top of the stack and push it twice
$  Swap the top two functions on top of the stack
%  Pop the function on top of the stack and throw it away
/  Pop a compound function. Split off the first function, push what's left,
   then push the first function.
.  Pop two functions, concatenate them and push the result
+  Pop a function. If its a constant then increment it. Push it
-  Pop a function. If its a constant then decrement it. Push it
<  Get a character from STDIN and push it to the stack. Pushes -1 on EOF.
>  Pop a function and print its ASCII character if its a constant
c  Pop a function and print its value if its a constant
w  Pop a function from the stack. Peek at the top of the stack. While it is
   a non-zero constant, execute the function.

Typing a command at the prompt will execute the command. Type # at the prompt
(the duplicate command). You should see
> #
003: (-10)
002: (11)
001: (11)
>

Notice that the (11) has been duplicated. Now type % at the prompt (the drop
command). You should see
> %
002: (-10)
001: (11)
>

To push a command to the stack, simply enclose it in parenthesis. Type (-) at
the prompt. This will push the decrement operator to the stack. You should see
> (-)
003: (-10)
002: (11)
001: (-)
>

Compound functions
You may also enclose multiple atomic functions in parenthesis to form a compound
function. When you enter a compound function at the prompt, it is pushed to the
stack. Type ($+$) at the prompt. You should see
> ($+$)
004: (-10)
003: (11)
002: (-)
001: ($ + $)
>

Technically, everything on the stack is a compound function. However, some of
the compound functions on the stack consist of a single atomic function (in
which case, we will consider them to be atomic functions for the sake of
convenience). When manipulating compound functions on the stack, the . command
(concatenation) is frequently useful. Type . now. You should see
> .
003: (-10)
002: (11)
001: (- $ + $)
>

Notice that the first and second functions on the stack were concatenated, and
that the second function on the stack comes first in the resulting list. To
execute a function that is on the stack (whether it is atomic or compound), we
must issue the w command (while). The w command will pop the first function
on the stack and execute it repeatedly so long as the second function on the
stack is a non-zero constant. Try to predict what will happen if we type w.
Now, type w. You should see
> w
002: (1)
001: (0)
>

Is that what you expected? The two numbers sitting on top of the stack were
added and their sum remains. Let's try it again. First we'll drop the zero and
push a 10 by typing %10. You should see
> %10
002: (1)
001: (10)
>

Now we'll type the entire function in one shot, but we'll add an extra % at
the end to get rid of the zero. Type (-$+$)w% at the prompt. You should see
> (-$+$)w%
001: (11)
>

(Note this algorithm only works if the first constant on the stack is positive).
Strings
Strings are also present. They are mostly syntactic sugar, but can be quite useful. When the interpreter encounters a string, it pushes each character from last to first onto the stack. Type % to drop the 11 from the previous example. Now, type 0 10 "Hi!" on the prompt. The 0 will insert a NULL terminator and the 10 will insert a new-line character. You should see
> 0 10 "Hi!"
005: (0)
004: (10)
003: (33)
002: (105)
001: (72)
>

Type (>)w to print characters from the stack until we encounter the NULL terminator. You should see
> (>)w
Hi!
001: (0)
>

Conclusions
Hopefully this should be enough to get you started with the interpreter. The
language design should be relatively straight-forward. Let me know if anything is terribly unclear :) A few things have been left intentionally vague: values must be signed and at least 16 bits, the stack must be large enough to run all reference programs, etc. Many details haven't been carved out here because a full blown language specification would be prohibitively large to post (and I haven't written one yet :P). When in doubt, mimic the reference implementation.
The esolangs.org page for Clem
The reference implementation in C

You say you haven't written the language specification yet. I take it then that you're the originator of the language?

@COTO That is correct. I created the language.

Very important question: do you pronounce it "klem" or "see-lem"?

@MartinBüttner: "klem" :)

An "interpreter" to me implies a program that simply runs the various Clem instructions, not a complete shell such as the one you're using to view/manipulate the stack. However, you've included instructions such as q and h which really only have meaning in a shell context. Hence to get to my point: do you want an interpreter or a shell?

@COTO I want an interpreter. The shell does not need to be implemented. Specifically, the q and h commands need not be implemented. I'll remove them from the post.

I take it that ; is a comment to end of line, but the spec doesn't mention it.. must I implement it or can I ignore it? the examples do use it..

@Claudiu Yes, comments must be implemented. Anything that is required to run the examples must be implemented.

Almost done! Just dealing with negative number literals. You should perhaps add examples that exercise those (e.g. 0- 1cc should output 1-1, while 0-1cc should output -10)

If I were you, I change the name... It sounds awfully like phlegm

You might want to specify the direction in which the @ command rotates the 3 top functions. (001-->002-->003-->001, or 003-->002-->001-->003)

too bad I were too late.

@Orby thank you for the accepting my answer. I thought I was not going to get it

It's amazing what someone (@ceilingcat) who is good at golfing can do.  The C version is now amazingly short.

Haskell, 931 921 875
this isn't fully golfed yet but it will probably never be. Still, it is already shorter than all other solutions.
I will golf this more soon. I don't feel like golfing it any more than this.
probably has a few subtle bugs because I didn't play with the C reference implementation.
this solution uses the type StateT [String] IO () to store a "runnable" clem program. most the program is a parser which parses the "runnable program".
in order to run this use r "<insert clem program here>".
import Text.Parsec
import Control.Monad.State
import Control.Monad.Trans.Class
import Data.Char
'#'%(x:y)=x:x:y
'%'%(x:y)=y
'@'%(x:y:z:w)=y:z:x:w
'$'%(x:y:z)=y:x:z
'/'%((a:b):s)=[a]:b:s
'+'%(a:b)=i a(show.succ)a:b
'.'%(a:b:c)=(a++b):c
_%x=x
b=concat&between(s"(")(s")")(many$many1(noneOf"()")<|>('(':)&((++")")&b))
e=choice[s"w">>c(do p<-t;let d=h>>= \x->if x=="0"then a else u p>>d in d),m&k,s"-">>(m&(' ':)&k<|>c(o(\(a:b)->i a(show.pred)a:b))),s"c">>c(do
 d<-t
 i d(j.putStr.show)a),o&(++)&map(show.ord)&between(s"\"")(s"\"")(many$noneOf"\""),(do
 s"<"
 c$j getChar>>=m.show.ord),(do
 s">"
 c$do
 g<-t
 i g(j.putChar.chr)a),m&b,o&(%)&anyChar]
k=many1 digit
i s f g|(reads s::[(Int,String)])>[]=f$(read s::Int)|0<1=g
t=h>>=(o tail>>).c
c n=return n
a=c()
h=head&get
(&)f=fmap f
m=o.(:)
o=modify
u=(\(Right r)->r).parse(sequence_&many e)""
r=(`runStateT`[]).u
s=string
j=lift

Python, 1684 1281 characters
Got all the basic golf stuff done. It runs all the example programs and matches the output character-for-character.
import sys,os,copy as C
L=len
S=[]
n=[S]
Q=lambda:S and S.pop()or 0
def P(o):
 if o:n[0].append(o)
def X():x=Q();P(x);P(C.deepcopy(x))
def W():S[-2::]=S[-1:-3:-1]
def R():a,b,c=Q(),Q(),Q();P(a);P(c);P(b)
def A(d):
 a=Q()
 if a and a[0]:a=[1,a[1]+d,lambda:P(a)]
 P(a)
def V():
 a=Q();P(a)
 if a and a[0]-1and L(a[2])>1:r=a[2].pop(0);P(r)
def T():
 b,a=Q(),Q()
 if a!=b:P([0,0,(a[2],[a])[a[0]]+(b[2],[b])[b[0]]])
 else:P(a);P(b)
def r():a=os.read(0,1);F(ord(a)if a else-1)
def q(f):
 a=Q()
 if a and a[0]:os.write(1,(chr(a[1]%256),str(a[1]))[f])
def e(f,x=0):f[2]()if f[0]+f[1]else([e(z)for z in f[2]]if x else P(f))
def w():
 a=Q()
 while a and S and S[-1][0]and S[-1][1]:e(a,1)
def Y():n[:0]=[[]]
def Z():
 x=n.pop(0)
 if x:n[0]+=([[0,0,x]],x)[L(x)+L(n)==2]
D={'%':Q,'#':X,'$':W,'@':R,'+':lambda:A(1),'-':lambda:A(-1),'/':V,'.':T,'<':r,'>':lambda:q(0),'c':lambda:q(1),'w':w,'(':Y,')':Z}
def g(c):D[c]()if L(n)<2or c in'()'else P([0,1,D[c]])
N=['']
def F(x):a=[1,x,lambda:P(a)];a[2]()
def E():
 if'-'==N[0]:g('-')
 elif N[0]:F(int(N[0]))
 N[0]=''
s=j=""
for c in open(sys.argv[1]).read()+' ':
 if j:j=c!="\n"
 elif'"'==c:E();s and map(F,map(ord,s[:0:-1]));s=(c,'')[L(s)>0]
 elif s:s+=c
 elif';'==c:E();j=1
 else:
    if'-'==c:E()
    if c in'-0123456789':N[0]+=c
    else:E();c in D and g(c)

Testing:
Gather clemint.py, clemtest_data.py, clemtest.py, and a compiled clem binary into a directory and run clemtest.py.
Expanation:
The most ungolfed version is this one. Follow along with that one.
S is the main stack. Each item of the stack is a 3-list, one of:
Constant: [1, value, f]
Atomic: [0, 1, f]
Compound: [0, 0, fs]

For the constants, f is a function which pushes the constant onto the stack. For the atmoics, f is a function which executes one of the operations (e.g. -, +). For the compounds, fs is a list of items.
xec executes an item. If it's a constant or an atomic, it just executes the function. If it's a compound, if there has been no recursion yet, it executes each function. So executing (10 20 - 30) will execute each of the functions 10, 20, -, and 30, leaving 10 19 30 on the stack. If there has been recursion, then it just pushes the compound function onto the stack. For example, when executing (10 20 (3 4) 30), the result should be 10 20 (3 4) 30, not 10 20 3 4 30.
Nesting was a bit tricky. What do you do while reading off (1 (2 (3 4)))? The solution is to have a stack of stacks. At each nesting level, a new stack is pushed on the stack of stacks, and all push operations go onto this stack. Further, if there has been nesting, then atomic functions are pushed instead of executed. So if you see 10 20 (- 30) 40, 10 is pushed, then 20, then a new stack is created, - and 30 are pushed onto the new stack, and ) pops off the new stack, turns it into an item, and pushes it onto the stack one level down. endnest() handles ). It was a bit tricky since there's a special case when only one item has been pushed and we're pushing back onto the main stack. That is, (10) should push the constant 10, not a composite with the one constant, because then - and + don't work. I'm not sure whether this is principled but it's the way it works...
My interpreter is a character-by-character processor - it doesn't create tokens - so numbers, strings, and comments were somewhat annoying to deal with. There's a separate stack, N, for a currently-being-processed-number, and anytime a character which isn't a number is processed, I have to call endnum() to see whether I should first complete that number and put it on the stack. Whether we're in a string or a comment is kept track of by boolean variables; when a string is closed it pushes all the innards on the stack. Negative numbers required some special handling as well.
That's about it for the overview. The rest was implementing all the built-ins, and making sure to do deep copies in +, -, and #.

Kudos! Did you have fun? :)

@Orby: I sure did! It's an interesting language, definitely a strange one. I'm hoping I can get an interpreter that's <1k. Not sure what to expect from other submissions.

C 832
Thanks to @ceilingcat for finding a much better (and shorter) version
This treats everything as simple strings - all stack items are strings, even constants are strings.
#define Q strcpy
#define F(x)bcopy(b,f,p-b);f[p-b x]=!Q(r,p);
#define C(x,y)Q(S[s-x],S[s-y]);
#define N[99]
#define A Q(S[s++]
#define D sprintf(S[s++],"%d"
#define G(x);}if(*f==x){
#define H(x)G(x)s--;
#define R return
#define Z(x)T(t,u,v)-1||putchar(x)H(
z=1,*y;char S N N;s;c;T(b,f,r,p)char*b,*f,*r,*p;{strtol(b+=strspn(b," "),&p,0);if(p>b){F()R 1;}if(c=*b==40){for(p=++b;c;p++)if(z^=*p==34)c+=*p-41?*p==40:-1;F(-1)R-1;}p++;F()*r*=!!*b;R 0;}*P(char*p){R*p-34?y=P(p+1),D,*p),y:++p;}E(int*x){char*p,c N,f N,r N,t N,u N,v N;for(Q(c,x);*c;Q(c,p)){Q(t,S[s-1]);if(T(c,f,p=r))A,f);else{{G(64)C(0,1)C(1,2)C(2,3)C(3,0)G(35)A,t)G(36)C(0,2)C(2,1)C(1,0)H(37)H(47)T(t,u,v);*v&&A,v);A,u)H(46)strcat(strcat(S[s-1]," "),t)H(43)D,atoi(t)+1)H(45)D,atoi(t)-1)G(60)D,getchar())H(62)Z(atoi(u))99)Z(*u)119)for(Q(u,t);atoi(S[s-1]);)E(u)G(34)p=P(p);}}}}

Try it online!
A less golfed version of my original (unlike the golfed version this one prints the stack when it ends if it is not empty and takes a -e parameter so you can specify the script on the command line instead of reading from a file):
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define FIRST_REST(x) memcpy(first, b, p - b); first[p - b - x] = '\0'; strcpy(rest, p);
#define COPY(dest,src) strcpy(stack[size + dest], stack[size + src]);
char stack[9999][9999]; int size = 0;
int token(char *b, char *first, char *rest)
{
    while (*b == 32) b++;
    char *p; int x = strtol(b, &p, 0);
    if (p > b) { FIRST_REST(0) return 1; }
    if (*b == '(') { int c = 1; for (p = ++b; c; ++p) c += (*p == '(') - (*p == ')'); FIRST_REST(1) return -1; }
    p++; FIRST_REST(0) if (!*b) *rest = '\0'; return 0;
}
char *push(char *pointer)
{
    if (*pointer == '\"') return pointer+1;
    char *result = push(pointer+1);
    sprintf(stack[size++], "%d", *pointer);
    return result;
}
void eval(char *x)
{
    char program[9999], first[9999], rest[9999], tos[9999], tmp1[9999], tmp2[9999];
    char *pointer;
    for (strcpy(program, x); *program; strcpy(program, pointer))
    {
        *stack[size] = '\0';
        strcpy(tos, stack[size-1]);
        if (token(program, first, rest))
        {
            pointer = rest;
            strcpy(stack[size++], first);
        }
        else
        {
            pointer = rest;
            if (*first == '@'){
                COPY(0, -1) COPY(-1, -2) COPY(-2, -3) COPY(-3, 0) }
            if (*first == '#')
                strcpy(stack[size++], tos);
            if (*first == '$'){
                COPY(0, -2) COPY(-2, -1) COPY(-1, 0) }
            if (*first == '%')
                size--;
            if (*first == '/'){
                size--; token(tos, tmp1, tmp2); if (*tmp2) strcpy(stack[size++], tmp2); strcpy(stack[size++], tmp1); }
            if (*first == '.'){
                size--; strcat(stack[size - 1], " "); strcat(stack[size - 1], tos); }
            if (*first == '+'){
                size--; sprintf(stack[size++], "%d", atoi(tos) + 1); }
            if (*first == '-'){
                size--; sprintf(stack[size++], "%d", atoi(tos) - 1); }
            if (*first == '<')
                sprintf(stack[size++], "%d", getchar());
            if (*first == '>'){
                size--; if (token(tos, tmp1, tmp2) == 1) putchar(atoi(tmp1)); }
            if (*first == 'c'){
                size--; if (token(tos, tmp1, tmp2) == 1) printf("%s", tmp1); }
            if (*first == 'w'){
                size--; strcpy(tmp1, tos); while (atoi(stack[size - 1])) eval(tmp1); }
            if (*first == '\"')
                pointer=push(pointer);
        }
    }
}
int main(int argc, char **argv)
{
    char program[9999] = "";
    int i = 0, comment = 0, quote = 0, space = 0;
    if (!strcmp(argv[1], "-e"))
        strcpy(program, argv[2]);
    else
    {
        FILE* f = fopen(argv[1], "r");
        for (;;) {
            char ch = fgetc(f);
            if (ch < 0) break;
            if (!quote) {
                if (ch == '\n') comment = 0;
                if (ch == ';') comment = 1;
                if (comment) continue;
                if (ch <= ' ') { ch = ' '; if (space++) continue; }
                else space = 0;
            }
            if (ch == '\"') quote = 1 - quote;
            program[i++] = ch;
        }
        fclose(f);
    }
    eval(program);
    for (int i = 0; i < size; i++) printf("%03d: (%s)\r\n",size-i,stack[i]);
    return 0;
}

Nice! Impressive you beat the Python solution in C. I have to upload my shorter version, I managed to shave off 60 bytes or so.. I still wonder if there's a different approach which would yield way less than 1000 characters

@Claudiu I thought so too - but I couldn't figure out how.

@ceilingcat I'm quite surprised that works without exploding.  We are accepting a parameter that we never pass but I guess that still creates a slot on the stack so when strtol writes to it nothing else gets overridden.  I've learned something.

@ceilingcat Thanks for the golfing - I would never have seen the one with the xor - that was just clever.

@ceilingcat  Thanks so much for all the golfing help.  I have learned a lot from your suggestions.

Scala, 1014 1009 bytes
import util._
val n="([+-]?\\d+)(.*)".r
def c(z:String):(String,String)=z.trim match{
case s"($x"=>var i,b=0
while(-1<b&i<x.size){if(x(i)=='(')b+=1
if(x(i)==')')b-=1
i+=1}
(x.slice(0,i-1),x drop i)case n(x,t)=>(x,t)case x=>x.slice(0,1)->x.tail}
def f(z:String,r:List[String]=Nil):List[String]="\"([^\"]*)\"".r.replaceAllIn(z.trim,m=>m.group(1).reverse.flatMap(" " + _.toInt + " "))match{case ""=>r
case s"($x"=>val(a,b)=c(z.trim);f(b,a::r)case n(x,t)=>f(t,""+x.toInt::r)case s"@$t"=>val a::b::c::d=r
f(t,b::c::a::d)case s"#$t"=>f(t,r.head::r)case s"$$$t"=>val a::b::c=r
f(t,b::a::c)case s"%$t"=>f(t,r.tail)case s"/$t"=>val(a,b)=c(r.head.trim)
f(t,a::b.trim::r.tail)case s".$t"=>val a::b::c=r
f(t,s"$a$b"::c)case s"<$t"=>f(t,Try{""+io.StdIn.readChar}.getOrElse("-1")::r)case s">$t"=>Try{print(r.head.toInt.toChar)}
f(t,r.tail)case s"c$t"=>Try{print(r.head.toInt)}
f(t,r.tail)case s"w$t"=>var h::u=r
while(u.head!="0")u=f(h,u)
f(t,u)case x=>f(x.tail,""+(Try{r.head.toInt+s"${x(0)}1".toInt}getOrElse-1)::r.tail)}

Try it online
Wow, this got long. I'll add an explanation later.
Ungolfed

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


text:
Check the jumbled words
This is an easy one.
Anagrams are words which have the same characters but in different order. All you have to do is to figure out if two strings are anagram or not.
Rules:

Take two strings as a function argument, command-line argument or from standard input.
Write a function or program which returns truthy value if strings are anagram, falsy value otherwise
Anagrams may have different number of spaces () characters in them.
Anagrams are case insensitive matches.
Anagrams can only have printable ASCII characters for this code-golf.

For example(taken from the Wikipedia page itself): Doctor Who is an anagram of Torchwood . Note missing space and lack of capital D and W in Torchwood
This is code-golf so minimum bytes code win!
Happy golfing.

Done - Edited to clarify

If that is considered as standard input (STDIN) then yes.

printable ascii or alphanumeric? what about ,:;...?

@MartinBüttner No objection against ARGV from my side. Feel free to edit the question to point it out in clear words as I might not be able to make it clear.

@edc65 Well, these are just words, not sentences, so ideally those characters should not appear. But if they do, they are to be considered. Same for numbers

It's an easy one, but attracts an unusual number of wrong answers ...

The preprocessing required to make this the same as the existing anagram is to remove spaces and lower-case, which is a pretty trivial transformation.

Anagram Code Golf! did not show up in suggestions while I was creating this one. Weird.

Not exactly the same, and not all the answers of the old question are valid for this question (No special characters, only A-Z)

@PeterTaylor The rules of the other one are completely opposite of my rules, thus the transformations are not trivial when you think from [tag:code-golf] point of view

@edc65, "duplicate" doesn't mean "identical" on this site. It also covers simple transformations.

CJam, 15 11 bytes
Just thought I'd practice CJam a bit more. This is basically the same as my Ruby answer (or most answers):
ea{S-el$}/=

Quick explanation
ea          "Push command line arguments";
ea{     }/  "For each element in that array";
ea{S-   }/  "Push a space character onto the stack and remove spaces from string";
ea{S-el }/  "Convert string to lower case";
ea{S-el$}/  "Sort the characters in the string";
ea{S-el$}/= "Check for equality";

Prints 1 for anagrams and 0 otherwise.

Brackets can be unmatched in CJam, so you don't need the [ in [ll]. ea would be even shorter; it pushes all command-line arguments as an array. Doesn't work with the online interpreter though... 2. S is initialized to " ", so you can use it instead of ' . 3. You can replace %~ with /.

Java, 146 131 144 134 131 128
Not a very exciting answer. Returns true for anagrams, false for others. Actually works now. Cheapass abuse of generics in class declaration.
boolean b(T a,T b){return c(a).equals(c(b));}T c(T a){char[]c=a.toLowerCase().toCharArray();sort(c);return(T)valueOf(c).trim();}

Ungolfed:
boolean b(T a,T b) {
    return c(a).equals(c(b));
}

T c(T a) {
    char[] c = a.toLowerCase().toCharArray();
    sort(c);
    return (T) valueOf(c).trim();
}

mmm... cat and faq?

Two different strings can have the same ASCII sum. Take, for e.g., the strings "bb"(98 + 98) and "ac"(97 + 99).

Is valueOf a static import?

yeah, same with sort

Ruby, 65 60 58 57 51 48 46 bytes
s,t=$*.map{|u|u.upcase.scan(/\S/).sort};p s==t

Edit: Switched to STDIN to save a few bytes.
Edit: Switched to ARGV to save three more bytes.
Quite long for such a simple problem, hmmmm.

For each string:

Turn to upper case (to make it case in-sensitive).
Split into non-whitespace characters.
Sort (by character code).

Then check that the results are equal.

Wow everything i would like to have in C# - nice one +1

Rebol   44   40
(Rebol 2)
Define a function m which takes two values a and b. Sort each string, trim the whitespace and use = to check if the strings are the same.
m: func[a b][(trim sort a)= trim sort b]

m: func[a b][equal? trim sort a trim sort b]
Example
>> m: func[a b][(trim sort a)= trim sort b]
>> m "Doctor Who" "Torchwood"
== true

It is useful handy that sort is case insensitive by default. Note: This function does have side effects if you use this code elsewhere as sort modifies a and b directly.
(sort should work in Rebol 3 but doesn't as there is a known bug)

Yes ... :(

That should work. Just a few chars longer

Wait, I don't understand. Just because sort sorts case insensitively, how does that make equal? work on strings of different cases?

Oh equal? itself is case insensitive, too. That's... handy.

and same? "ABC" "abc" is false :) Also has the shorthand "ABC" == "abc" - double equal signs means really equal!

@MARTINBÜTTNER The need to use == instead of = to get case sensitive comparison, and instruct the primitives to use it with a refinement (e.g. SORT/CASE instead of SORT) is a choice that leads to grumbling from some in the Rebol and Red community.  From a hardware point of view, it's kind of like "a" is "A" - handling uppercase specially being the exception and not the rule.  I've theorized that if keyboards had 52 letters Rebol would be case-sensitive by default, and if you had to push shift to get a [ and didn't for a { it would use curly braces for code blocks...

JavaScript (ES6) 68 99
Generate a key for each word and compare them. If only JS had some shorter ucase method...
A=(a,b,k=s=>[...s.toUpperCase()].sort().join('').trim())=>k(a)==k(b)

You always bring in unique techniques to the table :)

@Optimizer you're kind, but nothing new here, this is really a standard way to handle anagrams

No, I was talking about the declare a second method in the third argument and use it to save space trick.

Python 3 -- 73 67 bytes

Code:
f=lambda:sorted(i for i in input().upper()if" "!=i);print(f()==f())

As usual, nice looking, but not very short. Typical python...

Does a#b count as an word? Fixed.

The challenge asks for printable ASCII, so all characters except spaces should be treated as "letters" for the purposes of the challenge.

Cobra - 130
do(a='',b='')
    print (f=Func<of String,String>(do(s='')=s.toLower.toCharArray.toList.sorted.join('').trim)).invoke(a)==f.invoke(b)

Sorted first, then tolower: couldn't this create problems?

Bash+coreutils, 62 bytes
s()(tr -d '     '<<<"${@^^}"|fold -1|sort)
cmp <(s $1) <(s $2)

Takes arguments from the command line.  Return code 0 for TRUE and 1 for FALSE.  Also something like /dev/fd/63 /dev/fd/62 differ: byte 1, line 1 is output in the FALSE case.
Output:
$ ./anagram.sh "Doctor Who" Torchwood; echo $?
0
$ ./anagram.sh "Doctor Watson" Torchwood; echo $?
/dev/fd/63 /dev/fd/62 differ: byte 1, line 1
1
$

Clojure : 84 chars
Golfed:
(defn g[s](sort(remove #(= \  %)(seq(.toLowerCase s)))))
(defn f[a b](=(g a)(g b)))

Ungolfed:
(defn g[s] (sort (remove #(= \  %) (seq (.toLowerCase s)))))
(defn f[a b] (= (g a) (g b)) )

Driver program with execution:
(def a "Doctor   Who")
(def b "Torch woo d")
(println (f a b))

bash$ java -jar clojure-1.6.0.jar anagram.clj
true

JavaScript (ES6) 82
Returns true if the two strings are anagrams, otherwise returns false or throws an exception
e=(a,b)=>(a.replace(/\S/g,c=>b=b.replace(b.match(RegExp(c,'i'))[0],'')),!b.trim())

"or throws an exception" violates the rules, though. That's not a falsy value as required.

Throwing makes this an invalid entry :(

Perl - 84
Always need Perl in these...
sub c{map{s/\s//}@a=@_;(join'',sort split//,lc$a[0])eq join'',sort split//,lc$a[1]}

Wanted to be able to modify @_ directly but perl wont allow that

How should this be called? It doesn't seem to return a result.

It returns a 1 or a 0 --->    print c('Doctor Who','Torchwood') ? 'Yes' : 'No';

Groovy : 96 77 chars
Golfed:
g={it.findAll{it!=" "}.collect{it.toLowerCase()}.sort()}
f={a,b->g(a)==g(b)}

Ungolfed:
g = { it.findAll{ it!=" " }.collect{ it.toLowerCase() }.sort() }
f = { a,b -> g(a)==g(b) }

Example main program and execution:
a="Doctor Who x x"
b="Tor chwoo dxx"
println f(a,b)

$ groovy Anagram.groovy
$ true


text:
Penalty Shootout
Penalty shootout
Welcome to CG world cup. Your job: Code a penalty shooter and goal keeper!

Rules of the game:
The goal is 700 cm wide and 200 cm tall. If I have to make a rectangle out of it, the goal is ABCD where A is (0,0), B is (0,200), C is (700,200), D is (700,0).
The shooter gives me the coordinate where he will aim. However... there is wind, so your ball final destination may be modified up to 50 positive or negative.
Here's what I'm trying to say...
windX= randint(-50,50)
windY= randint(-50,50)
theFinalCoordinateOfTheBallX= coordinateThatBotGiveX + windX
theFinalCoordinateOfTheBally= coordinateThatBotGivey + windY

The goal keeper gives me the coordinate where he aims. If the distance of the ball final coordinate and the coordinate of the goal keeper is less then 50 cm (using Pythagoras), the ball is saved by the keeper, otherwise it's a goal.
(Note: It is very possible that you did not make a goal, because you MISS the goal. This is possible due to the wind factor. So aiming for (0,0) is not really good idea.)
Each of you has 10 attempts to become goal keeper and shooter.

Communication protocol:
You will receive this from STDIN

R Sx Sy Gx Gy

R-> Round # (Starts from 1 to 10)
Sx -> The x coordinate where the opponent aim when they shoot in previous round (Seperated by comma)
Sy -> The y coordinate where the opponent aim when they shoot in previous round (Seperated by comma)
Gx -> The x coordinate where the oppenent aim when they are goal keeper in the previous round (Seperated by comma)
Gy -> The y coordinate where the opponent aim when they are goal keeper in previous round (Seperated by comma)
Example:

3 57,81 29,90 101,50 27,85

Meaning
This is round 3
In round 1: When your opponent is shooter: He aims for (57,29). In round 2 he aims for (81,90)
In round 1: When your opponent is goal keeper. He aims for (101,27). In round 2 he aims for (50,85)
Another example:

1

This is round 1
No game yet! Prepare your bot for this kind of situation!
Your bot, must give me from STDOUT this:

Sx Sy Gx Gy

Sx -> My x coordinate of where do I aim when I'm the shooter this round.
Sy -> My y coordinate of where do I aim when I'm the shooter this round.
Gx -> My x coordinate of where do I am when I'm the goal keeper this round.
Gy -> My y coordinate of where do I am when I'm the goal keeper this round.
Example:

81 25 71 98

This means you aim for (81,25) when shooting and (71,98) when become goal keeper.
 All numbers that you will receive is integer. Your program must output integer too. Floating number is not tolerated

Deciding champion:
Win worths 3 points. Draw worths 1 point. Lost is a null.
After single-round robin, The 4 top high scoring bot will do double-round robin. Among this 4 bots, the champion will be crowned.

Technical details:
The program runs on Windows 7, using Python 2.7.2
Unfortunately, due to my programming skill, I can only receive entry from Python and C. (To Java users, my deepest apology) I'm confident that I can accept entry from C++ and Fortran. I will try when someone gives me a submission in that language...
C programs will be compiled manually using this command:

gcc programFile.c -o programFile

The same thing occurs to Fortran and C++, but since I haven't try, I'm not sure what precisely is the command.
Note: Since using Python 2.7.2, you may want to use raw_input instead of input
Your program may not use/modify/access external source. (Internet, environment variable, making file, accessing folder, external number, etc)
Your program must be deterministic, and please dont over kill random() =p
You may make multiples entry, but please dont help each other..
Make sure you give your bot a name...

FAQ:

Q: Is goals inclusive or exclusive?

A: Inclusive. So if your ball lands at (0,0) and it's out of the goal keeper's reach, it's counts as a goal. (Well irl, it will hit the post)

Q: What is the time limit?

A: 1 second

Q: What happened if my ball ends at (x,-y)

A: No goal Well, irl you cant aim downwards below the ground.

Q: But can my program outputs negative number?

A: Absolutely

Q: Any controllers so I can train my bot?

A: Here

Q: Does my program run 'on and off' or it will keep running until it gets and EOF?

A: On and off On a new round, I will call your bot and pass the necessary info. After you gave my your coordinate, it's done job.

Good luck, you will need it..

Wait, are bots invoked anew for every round or are the processes kept alive during the game? That is, does my program need to deal with a single round or does it need a loop?

They're invoked on and off. So just take 1 input, print and done. Another round, on and off.

AldoSerenaBot.py print -5000 -5000 0 0

Isn't this problem a little ill-posed? All somebody else has to do to beat my bot is run it, find out exactly where I'm shooting and blocking, and write a bot to shoot and block in all the right places. Adding a wind factor just changes the likelihood of victory; it doesn't change the optimal solution.

But your bot has more than one opponent, hopefully. You can't conquer all your enemy in just one bot...

Finding where you shoot is in fact the background of this challenge (I mean, seriously, when facing penalty kick, all goal keeper wants to know where the executor will aim..)

I guess my criticism can be boiled down to the fact that the more deterministic I make a bot, the easier it is to defeat. I could make a bot with the most sophisticated AI known to man and it would still be a trivial matter to build a bot that wipes it out (and as many competitor bots as the programmer deigns to target).

@COTO I agree. I don't think there is anything more optimal than something like Center or the random bot.

RandomBot, Python
from random import seed,randint
seed(raw_input())
print "%d %d %d %d" % (randint(50,650), randint(50,150), randint(50,650), randint(50,150))

As long as there are no predictable bots to beat, I believe this should be fairly optimal (of course, you could just seed the PRNG yourself to figure out what I'll be doing, but writing a bot to specifically kill one other bot isn't exactly sportsmanship, right? ;)). Obviously, this isn't good at catching, but without anyone to beat, I can't tell how to predict them.

Isn't this violate the rule of using external source? Randint uses seed, seed is somewhat from external source, right? I may need to reword the rule...

@Realdeo Usually "external source" refers to files (locally or remotely). If you want to exclude a random seed and the current time as well, you should clarify that. (In which case I'll just seed the PRNG myself.)

Nice try, but randint use _urandom which uses some external number using seed() or not. I had reword the rule. Thanks for pointing flaw...

@Realdeo I'd argue that for the purpose of this challenge "external number" means anything that no other bot can reliably reproduce. If I seed the PRNG, and some other user uses the same seed to predict how I will act, they will be successful in that. I don't see why implementing my own PRNG would make my bot any more deterministic or reproducible than that, but I guess I'll have to do that now. (If you're not going by this definition any built-in function might use some "external number" under the hood to compute something.)

That's it! Deterministic. That's the word that's what I'm looking for! Thank you =) If only we don't get through this whole trouble.

@Realdeo in that case, using random.seed with the program's input as deterministic as I can make it. whenever you will run my program (as it currently is) with the same history, it will produce the same output.

Related

Actually this does not do a good job. The best that this program can do is actually tie. I make 4 runs on the program vs 4 my program (not random and deterministic, trust me) and this program cant score a win... Well, shoot randomly, catch randomly..

@Realdeo Yes, good point. Random is only the optimal shooting technique, not the optimal catching technique, of course. But I don't have any programs to predict, so I can't come up with a good prediction algorithm yet ;)

Center, Python
This bot acts just as I would: It stays in the center when being the goal keeper (jumping is hard), and when shooting it does the exact opposite: it aims for one of the corners.
It doesn't care what happened in previous rounds and thus is a good victim for bots that do take this information into consideration.
import random
random.seed(raw_input())
corners = [[50,50],[50,150],[650,50],[650,150]]
corner = random.choice(corners)
print "%d %d %d %d" % (corner[0], corner[1], 350, 100)

Nondeterministic. Doesn't meet specs.

@Soham Chowdhury can you expand on that? random itself is deterministic, and I don't see anything in my program that would make it non-deterministic (it produces same output for same input, and always passes through the same states as far as I can tell).

Oh, my bad, then.

Averager (Python)
This is my second serious answer on this site and my first KOTH. Be kind, good sirs.
Yes. The code looks pretty.
rl = lambda l: map(int, l.split(","))
avg = lambda l: sum(l)/len(l)

def take_input():
    r = raw_input()
    t = True if len(r.split()) == 1 else False
    (rno, sx, sy, gx, gy) = (r,'0','0','0','0') if t else r.split()
    return (int(rno),) + tuple(map(rl, [sx, sy, gx, gy]))

def g(d):
    return((avg(d[1]) + 350)/2, (avg(d[2]) + 100)/2)

def s(d):
    return (abs((avg(d[3]) - 350)/2), abs((avg(d[4]) - 100)/2))

def out(d):
    print "%d %d %d %d" % (s(d) + g(d))

out(take_input())

Halp and tast k?

This is not deterministic, I'm afraid. Try make two runs of this program twice with the same input. Result is different. Try again =)

Oh, damn, I forgot that.

@Realdeo there you are!

CenteredRandom (Python)
from random import randint, seed, choice

rl = lambda l: map(int, l.split(","))
avg = lambda l: sum(l)/len(l)
avg2 = lambda l, x: avg(l[:-x]) if x < len(l) else avg(l)

corners = choice([[50,50],[50,150],[650,50],[650,150]])

def take_input():
    r = raw_input()
    seed(r)
    t = True if len(r.split()) == 1 else False
    (rno, sx, sy, gx, gy) = (r,'0','0','0','0') if t else r.split()
    return (int(rno),) + tuple(map(rl, [sx, sy, gx, gy]))

def enemy_is_center(d):
    return len(d[3]) > 2 and len(d[4]) > 2 and d[3][-2:] == [350, 350] and d[4][-2:] == [100, 100]

def s(d):
    return (100,100) if enemy_is_center(d) else (randint(50, 650), randint(50, 150))

def g(d):
    return (corners[0], corners[1]) if enemy_is_center(d) else (randint(50, 650), randint(50, 150))

def out(d):
    print "%d %d %d %d" % (s(d) + g(d))

out(take_input())


text:
Generate Eban Numbers
(Continuing on the number sequences code-golf, here is an interesting sequence)
Eban Numbers (A006933) are the sequence of numbers whose names (in English) do not contain the letter "e" (i.e., "e" is "banned")
The first few numbers in the sequence are:
2, 4, 6, 30, 32, 34, 36, 40, 42, 44, 46, 50, 52, 54, 56

Given an integer n, via function argument or STDIN, return the first n terms of the Eban Numbers (in numbers) .
Since some answers will involve some sort of string check for character e, assume that the maximum value of n can be such that the nth Eban number is less than 1 Quadrillion.

related: https://codegolf.stackexchange.com/questions/36512/rosetta-stone-code-challenge

Searching questions on this site is pretty primitive ... Anyways, Eban numbers are more tricky than Iban in so many ways :)

Do the terms have to be output numerically, or may they be output as words?

Yes, numeric output.

Are we allowed to use modules off CPAN that aren't in the core if doing a Perl solution?

Anything is fine, just call it out and tell how to test it. (like what to install etc)

Mathematica CJam, 108 95 46 35 30 bytes
Edit: Ported to CJam! The original and ungolfed Mathematica code is at the bottom and explains the algorithm quite well.
li,{)Kb65430s2046sm*$f=0s*ip}/

And now I know CJam. :D Thanks to Dennis for some golfing improvements.
After analysing them a bit to determine how many there are below one quadrillion, I came to the conclusion that all eban numbers are basically base-1000 numbers using only a set of 20 digits:
0, 2, 4, 6, 30, 32, 34, 36, 40, 42, 44, 46, 50, 52, 54, 56, 60, 62, 64, 66

So we enumerate them by converting the input to base 20, picking the right digit from the set and build a base 1000 number from it.
This is how the code works in detail:
li                             "Read from STDIN, convert to integer n";
li,                            "Turn into a range array [0 ... n-1]";
li,{                        }/ "For each number execute a block";
li,{)                       }/ "Increment";
li,{)K                      }/ "K is initialised to 20, push that";
li,{)Kb                     }/ "Convert to base 20";
li,{)Kb65430s               }/ "Push a string with possible multiples of 10";
li,{)Kb65430s2046s          }/ "Push a string with possible least significant digits";
li,{)Kb65430s2046sm*        }/ "Take the Cartesian product of the two character
                                arrays, generating the 20 'digits'";
li,{)Kb65430s2046sm*$       }/ "Sort the result";
li,{)Kb65430s2046sm*$f=     }/ "For each digit in our base-20 number, get the
                                base-1000 digit from the list";
li,{)Kb65430s2046sm*$f=0s   }/ "Push a '0' character";
li,{)Kb65430s2046sm*$f=0s*  }/ "Join all the digits, with that '0' as the delimiter";
li,{)Kb65430s2046sm*$f=0s*ip}/ "Convert to an integer and print the result";

Here was the original Mathematica code, which doesn't encode the digit list and is hence fairly readable:
{0,2,4,6,30,32,34,36,40,42,44,46,50,52,54,56,60,62,64,66}[[IntegerDigits[#,20]+1]]~FromDigits~1000 & /@ Range @ # &

Unprintable characters would work just fine. You can replace 20 with K, 1000 with 1e3, {i41-}% with 41f- and {")+-/GIKMQSUW[]_aegik"41f-=}% with ")+-/GIKMQSUW[]_aegik"41f-f=. Futhermore, the array (string) could be pushed as [4U5Z6][U4Y6]m*Afb$ (m* is Cartesian product, $ is sort), for a total of 33 bytes (35 if you prepend li to read from STDIN).

@Dennis I knew I was missing out on a lot of good tricks, thanks! ;) I just remembered that CJam happily deals with large bases so I quickly wanted to throw something together, because I figured this could beat all other answers. I'll go through your tips and work them in when I understand why they work. :)

You can save 5 more bytes by using strings instead of numbers, eliminating the need for the last two base conversions: li,{)Kb65430s2046sm*$f=0s*ip}/. Unfortunately, 'ﾖis'०is has the same byte count as 65430s2046s.

@Dennis Interesting. What's the difference between / and %?

Doesn't really matter here, just force of habit. % collects the results in an array, so it leaves an empty array on the stack here. Since those aren't printed, it would only matter for a function.

@Dennis oh right "each" vs "map" should have clicked.

Bash+coreutils+BSDGames package, 79 70 bytes
seq $[9**16]|while read n
do number $n|grep -q e||echo $n
done|sed $1q

Unfortunately this spawns number $n|grep -q e for every number, so is rather slow.
Output:
$ ./eban.sh 5
2
4
6
30
32
$

Previous answer - outputs words instead of digits, 43 bytes
seq $[9**16]|number -l|grep -v [e.]|sed $1q

This outputs each term written in words:
$ ./eban.sh 5
two
four
six
thirty
thirty-two
$

A bit faster, because each process is only spawned once.

Much faster, no dependence on cheaty number, 77 bytes
t=0{0,3,4,5,6}{0,2,4,6}
eval echo $t$t$t$t$t|tr \  '
'|sed "s/^0*//;$[$1+1]q"

This one uses bash brace expansion to generate all (according to my thinking) eban numbers up to 10^15.  Looking at each group of 3 digits, the units digit must be one of {zero,two,four,six}, the tens digit must be one of {zero,thirty,forty,fifty,sixty}, and the hundreds digit must be zero.  Since x-illion contains no e's up to quadrillion, then
we can just combine the groups of three digits up to one quadrillion.  The only exception is zero which must be skipped.
So we simply build a brace expansion to generate all these numbers.  There are thus 205-1 of them (3.2 million).  Evaluating the full bash brace expansion takes less than 5 seconds on my VM.
The sed expression just strips off leading zeros and counts to n.
Output:
$ time ./eban.bash 5

2
4
6
30
32

real    0m4.065s
user    0m3.724s
sys 0m0.276s
$ ./eban.bash 10000000 | wc -w
3199999
$ ./eban.bash 3199999 | tail -5
66066066066056
66066066066060
66066066066062
66066066066064
66066066066066
$

Will this first generate 10^15 numbers and then stop at $1 ? or incrementally check and stop generating after 5th number ?

@Optimizer seq can generate that many numbers, but because this is all a long pipeline, whenever any one of the processes quits, the shell will send a SIGPIPE to all processes in the pipeline, and thus they will all quit.  In this case, the sed $1q will quit after the nth line it receives, and thus the rest of the pipline will be torn down, before seq can count much further (modulo buffering in each pipe).

I think you can probably play around and print the actual number instead of the English version. Maybe via awk/sed.

please do it...

That sounds fast. Although, I am not getting any output on my MINGW32. It runs and prints a new line.

@Optimizer looks like MinGW uses an ancient version of bash (3.1.17) which doesn't support the {start..end..step} brace expansion.  I've edited the answer slightly at a cost of zero extra bytes to use a different form which I think should work.

Now it just throws : eban.sh: xmalloc: cannot allocate 8 bytes (0 bytes allocated) and online compilers timeout. I'll be okay if anyone else can confirm that the faster approach is correct

@Optimizer Looks like that old bash version has poor memory management.  If you're serious about testing the more Linuxey answers, I recommend you install some distro (Ubuntu is easy) in a VM.  Virtualbox and VMWare player are free, I think.  Another thing you can try for this answer is replace $t$t$t$t$t with $t$t$t$t.  With this the script will work with numbers up to 1 trillion.

That helps and now I can see the output. It really is fast.

Ruby, 128 121 119 bytes
f=->n{a=[]
i=0
(j=i+=2
b=p
(m=j%t=1000
b=b||m%2>0||m%10==8||m>9&&m<30||m>69
j/=t)while j>0
a<<i if !b)while a.size<n
a}

I'm basically just checking groups of three digits for numbers that contain es, because none of {thousand, million, billion, trillion, quadrillion} contains an e.

You can safely do i+=2 as all numbers in Eban numbers are even

@Optimizer lol yeah, since I have a m%2>0|| I was even aware of that. :D thanks!

Can you probably find out n where it crosses a quadrillion ? I don't have the setup and online compilers won't run for that big n

@Optimizer Not with the program. I'd need an optimised version which skips over thousands/millions/etc if the offending "e" comes from one of the more significant digits. But if I'm not mistaken, there should be Σ(n=1...5) 19^n = 2,613,659 eban numbers below a quadrillion.

@Optimizer I think I was mistaken. I think it should be 20^5-1 = 3199999 eban numbers below a quadrillion instead.

Perl - 78
Here is a Perl one-liner to do it.
perl -MLingua::EN::Numbers=num2en -nE'while($n<=$_){$n++&&say$i if num2en($i)!~/e/;$i++}' <(echo 5)

It is 50 characters plus 1 for the M, 1 for the n, and 26 for Lingua::EN::Numbers=num2len.
Using Lingua::EN::Numbers from CPAN. Here are instructions for installing CPAN modules.

Vyxal, 66 bitsv2, 8.25 bytes
Þ∞'∆ċ\ec¬;Ẏ

Try it Online!
Bitstring:
001001110101101011111000111110011011000101110000000110101001010010

Þ∞'∆ċ\ec¬;Ẏ
Þ∞           # infinite list of integers
  '      ;   # filter by
   ∆ċ\ec¬    # cardinal of the number does not contain 'e'
          Ẏ  # slice to length of input

Created with the help of Luminespire.

6.125 bytes: ∆ċ\e$F)ȯ (vyncoded)


text:
Find the Chromatic Number
Surprisingly, we haven't had any challenges on graph colouring yet!
Given an undirected graph, we can give each vertex a colour such that no two adjacent vertices share the same colour. The smallest number χ of distinct colours necessary to achieve this is called the chromatic number of the graph.
For example, the following shows a valid colouring using the minimum number of colours:

(Found on Wikipedia)
So this graph's chromatic number is χ = 3.
Write a program or function which, given a number of vertices N < 16 (which are numbered from 1 to N) and a list of edges, determines a graph's chromatic number.
You may receive the input and produce the output in any convenient format, as long as the input is not pre-processed. That is, you can use a string or an array, add convenient delimiters to the string or use a nested array, but whatever you do, the flattened structure should contain the same numbers as the examples below (in the same order).
You may not use built-in graph-theory related functions (like Mathematica's ChromaticNumber).
You may assume that the graph has no loop (an edge connecting a vertex with itself) as that would make the graph uncolourable.
This is code golf, the shortest answer (in bytes) wins.
Examples
Your program must at least solve all of these in a reasonable amount of time. (It must solve all inputs correctly, but it may take longer for larger inputs.)
To shorten the post, in the following examples, I present the edges in a single comma-separated list. You may instead use line breaks or expect the input in some convenient array format, if you prefer.
Triangle (χ = 3)
3
1 2, 2 3, 1 3

"Ring" of 6 vertices (χ = 2)
6
1 2, 2 3, 3 4, 4 5, 5 6, 6 1

"Ring" of 5 vertices (χ = 3)
5
1 2, 2 3, 3 4, 4 5, 5 1

Example picture above (χ = 3)
6
1 2, 2 3, 3 4, 4 5, 5 6, 6 1, 1 3, 2 4, 3 5, 4 6, 5 1, 6 2

Generalisation of the above for 7 vertices (χ = 4)
7
1 2, 2 3, 3 4, 4 5, 5 6, 6 7, 7 1, 1 3, 2 4, 3 5, 4 6, 5 7, 6 1, 7 2

Petersen graph (χ = 3)
10
1 2, 2 3, 3 4, 4 5, 5 1, 1 6, 2 7, 3 8, 4 9, 5 10, 6 8, 7 9, 8 10, 9 6, 10 7

Complete graph of 5 vertices, plus disconnected vertex (χ = 5)
6
1 2, 1 3, 1 4, 1 5, 2 3, 2 4, 2 5, 3 4, 3 5, 4 5

Complete graph of 8 vertices (χ = 8)
8
1 2, 1 3, 1 4, 1 5, 1 6, 1 7, 1 8, 2 3, 2 4, 2 5, 2 6, 2 7, 2 8, 3 4, 3 5, 3 6, 3 7, 3 8, 4 5, 4 6, 4 7, 4 8, 5 6, 5 7, 5 8, 6 7, 6 8, 7 8

Triangular lattice with 15 vertices (χ = 3)
15
1 2, 1 3, 2 3, 2 4, 2 5, 3 5, 3 6, 4 5, 5 6, 4 7, 4 8, 5 8, 5 9, 6 9, 6 10, 7 8, 8 9, 9 10, 7 11, 7 12, 8 12, 8 13, 9 13, 9 14, 10 14, 10 15, 11 12, 12 13, 13 14, 14 15

Could you define reasonable? 1 minute? 10?

@ThreeFx yes, 10 minutes is reasonable. half a day isn't. I don't want to be too rigorous on the limit, because then I need to test everything on the same (my) machine again. but let's say if it completes within an hour on your machine that's fine.

Python 2.7 - 122 109 111 109 108 103
f=lambda n,e,m=1:any(all(t*m//m**a%m!=t*m//m**b%m for(a,b)in e)for t in range(m**n))and m or f(n,e,m+1)

Usage:
print f(5, [(1, 2), (2, 3), (3, 4), (4, 5), (5, 1)])

Brute force by increasing the chromatic number (m) and check all possible colorings. One coloring can be described as a number in base m. So the possible colorings are 0, 1, ..., m^n-1.
edit: The complete graph of 8 vertices takes quite long. But my laptop solves it in about 10 minutes. The other test cases take only a few seconds.

edit 2: Read that preprocessing is allowed, so I let the index of the vertices start with 0: shortens t*m//m**x%m to t//m**a%m (-2). Dissolve lambda and put m into function params (-11)

edit 3: preprocessing is not allowed -> back to t*m (+4), simplified // to / (-2).

edit 4: remove square brackets in any (-2), thanks xnor.

edit 5: instead of taking modulo m twice, simply subtract them and afterwards use modulo (-1). This is also quite a performance improvement. All testcases together take about 25 seconds on my laptop.

edit 6: recursive call instead of while 1: and m+=1 (-5). Thanks again, xnor.

Nice method. A simple golf: You can remove the brackets in all([...]) if you encase the a,b in parens (which costs no chars here due to spacing) so that the all doesn't mistake them for additional arguments. Also, I suspect you can save chars if you recurse with a function call to the next highest m rather than using a while loop.

Thanks, the recursive approach takes +2 chars though. A for m in range(n+1) approach also.

I optimized the recursive approach a bit with any and the and/or trick, and then it saves some chars: f=lambda n,e,m=1:any(all(t*m//m**a%m!=t*m//m**b%m for(a,b)in e)for t in range(m**n))and m or f(n,e,m+1).

Java - 241 218
int k,j,c;int f(int n,int[]e){for(k=1;k<=n;k++)for(long p=0;p<x(n);p++){for(j=0,c=0;j<e.length;c=p%x(e[j])/x(e[j]-1)==p%x(e[j+1])/x(e[j+1]-1)?1:c,j+=2);if(c<1)return k;}return 0;}int x(int a){return(int)Math.pow(k,a);}

The most obvious way to do this given the constraints is brute force. Just step through each chromatic number k, and assign each color to each vertex. If no neighbors are the same color, you have your number. If not, move along.
This takes longest for the test case for χ = 8 (complete graphs suck here), but it's still under 15 seconds (ok, about 100s with latest edit).
Input is the number of vertices n, and an array of edge vertices e[] given in the same order as the OPs comma separated values.
With line breaks:
int k,j,c;
int f(int n,int[]e){
    for(k=1;k<=n;k++)
        for(long p=0;p<x(n);p++){
            for(j=0,c=0;
                j<e.length;
                c=p%x(e[j])/x(e[j]-1)==p%x(e[j+1])/x(e[j+1]-1)?1:c,
                j+=2);
            if(c<1)return k;
        }
    return 0;
}
int x(int a){return(int)Math.pow(k,a);}

Oh, and this assumes the input is some sort of colorable graph. If an edge loops from v1 to v1, or there are no vertices, it can't be colored and will output 0. It will still work for graphs with no edges χ=1, etc.

Python 3 - 162
Uses the same brute-force approach, but uses the itertools library for hopefully faster combination generation. Solves the complete 8-graph in < 1 min on my fairly ordinary machine.
import itertools as I
def c(n,v):
 for i in range(1,n+1):
  for p in I.product(range(i),repeat=n):
   if(0==len([x for x in v if(p[x[0]]==p[x[1]])])):return i

Example usage for the complete 8-graph case:
print(c(8,[x for x in I.combinations(range(8), 2)]))

Haskell, 163 bytes
p x=f(length x)(transpose x)1
f a[b,c]d|or$map(\x->and$g x(h b)(h c))(sequence$replicate a[1..d])=d|0<1=f a b c(d+1)
g a=zipWith(\x y->a!!x/=a!!y)
h=map(flip(-)1)

Usage would be like this:
p [[1, 2],[2, 3],[3, 1]]

Basic brute force approach. Check all the possible coloring combinations if they are valid. Not much else to say here except that I am happy to hear any tips for shortening this even further ;)

I'd say that decrementing the vertices and transposing them counts as "preprocessing". What I had in mind with "any convenient format" was rather that you could choose from flat list, nested list, string, string with convenient delimiters, etc... but the flattened structure should be the same as specified in the challenge.

@MartinBüttner Alright, I'll change it

@ThreeFx all id is the same as and, any id is the same as or and any id$map f list is the same as just any f list. also, you could do a few things with g: you can redefine it as g a=(and.).zipWith(\x y->a!!x/=a!!y), make it infix, change the input order to replace (\x->g x b c) with g b c or even make it completely points-free and inline it. some of these don't work together, so try them all and choose the best one :)

Did you just forget to update your input spec? I can't actually read Haskell to tell if you've changed the input format.

@MartinBüttner I thought it was only the -1 you were mentioning.

@ThreeFx Your input spec still contains "minus one". And the other thing was the transposing of the input array (expecting left and right halves in separate lists).

@MartinBüttner I think it is fixed, to the cost of maaaaany bytes. :D

How are you solving the 7th example without the number of vertices in the input?

@ThreeFx instead of using flip(-)1 you can use (-1+). it is parsed as a section of the + operator.