text:
Generating Minesweeper grids
Minesweeper is a logic game found on most OS's. The goal of the game is to determine where the mines are on a grid, given numbers indicating the number of mines around that spot.
Given a grid size, and a set of mines, generate the Minesweeper grid for that set of mines.
Input: Two integers indicating the grid size, and an undefined number of integers indicating the mine positions. Positions will be given as (column position, row position), and the indexes will start at row 1.
Output: The Minesweeper grid. If there are no mines around a block, print an x. For each new row, print a newline. Please output all mines as an asterisk *. Do not leave any whitespace between the values in the row when printing.
Test Cases:
Input "5 5 1 3 3 5 2 4":
xxxxx
11xxx
*21xx
2*21x
12*1x

Input "3 4 3 1 1 4 2 3 3 2":
x2*
13*
2*2
*21

Shortest code wins.

Are we safe to assume all inputs will have an even number of args? i.e. 5 5 1 will never be passed?

@Gaffi: Yep. The input will always be valid input.

The spec currently leaves the reader to deduce from the examples that the positions use 1-based indexes and that row 1 is at the top. (Or is the latter, at least, negotiable?)

@PeterTaylor: Yep. I guess I should make it more obvious.

If you're choosing your winner now, w0lf's Golfscript answer is 1 character shorter than mine.

He, I didn't notice that. I guess I will fix that. Thank you for pointing that out!

No problem. I'm still determined to find a way to shave a couple of characters off and regain the lead though. :-)

I came back to this question after a long time and noticed that Gareth's answer is the shortest one now, so I should be marked as the winner.

GolfScript 122 98 94 93 91 88 87 85 82 81 80 71
~]2/(\:m;~\:w*,{[.w%)\w/)]:^m\?)42{m{^*~-.*@@-.*+3<},,72or 48+}if}%w/n*

Online demos:
Test Case 1: link
Test Case 2: link

!!{a}{b}if uses one character more than necessary. '*' can be replaced with 42 because you're putting it in an array and then stringifying the array. Similarly you can use ASCII codes for the other output characters and save a character with or to handle the special case.

@PeterTaylor Wow, !!{a}{b}if was really stupid indeed. :) It's funny what high-level mistakes you can do while concentrated on details. I cannot figure out what you meant by using or.

Indeed! Coming back to a problem after time helps too. When I wrote a couple of code dissections for my GolfScript blog I spotted considerable improvements. With respect to my last suggestion, after ,, you have a number. You want to convert it to the corresponding string (or ASCII code) unless it's 0, in which case you want x. The ASCII codes for digits are sequential and run from 48. x is ASCII 120, which is 72+48. So you can do 72or 48+ and save a character over the string-based approach.

@PeterTaylor Great! Before you answered I managed to reduce that part to .48 120if+, but your or trick is two chars shorter.

@w0lf Gah! Just when I think I've got the lead back!

J, 124 116 112 101 87 86 85 84 83 82 79 76 75 72 68 characters
'0x'charsub|:1":3 3(+/@,+9*4&{@,);._3[1(}.x)}0$~2+>{.x=._2<\".1!:1[1

Found what I was looking for - a way to get rid of the spaces (1":) - and finally I'm competitive. Now I just need to figure out the empty set of mines problem.
Takes input from the keyboard.
Edit
New version makes use of a side effect of 1": - numbers larger than 9 are replaced by *.

I've noticed two things: 1. It prints spaces instead of 0, not x; 2. Fails if the set of mines is empty (ex: 10 10 - should print an empty 10x10 board, but returns |length error)

But othwerwise it works, so +1.

@w0lf Ah, I was still thinking of the first draft of the question - in that version x just represented a space. I didn't notice that it had changed. Hmm, never thought that the set of mines would be empty...I'll have to work on that.

now I see that the question has been edited. I had not seen the old revision. :)

@w0lf Thanks. I found a couple of good rearrangements that helped get rid of some unnecessary brackets. I can see one space I could remove, but I suspect I'm pretty much at my limit. And there's still the empty mines list problem... :-)

I also suspected I was at my limit when I was at 90+ :-) So I guess this isn't over. I'm sure you'll think of something. :-)

brainfuck, 1001 896 bytes
,[>,]-[<]>>++[<[<+<+>>-]<[>+<-]>[>]>[>>[>>>>]>]++[-<+]-[<]<++[>>[>]>[>>[>>>>]>]+<++[-<+]-[<]<-]>>>-]>[>]>[>>[>>>>]<<<->>>>]+[-<+]-[<]>>[[>]>--<<[<]>>[[>]+[->+]+>>[>>>>]>--<+[-<+]-[<]>>-]>[>]+[->+]+>>--<+[-<+]-[<]<[>>[>]+[->+]+>>>>--<+[-<+]-[<]<-]>>[>]+[->+]+>++[-<+]-[<]>>]>[+>>[>>>>]>]<<<<<[<<<<]>>-<+[-<+]>>>>[>>>>]>[-[--<<<<<[<<<<]>>>>--[>>>>]>>>[>>>>]>>>--<+[-<+]++>>>>>>[>[<--<<<[-[>>>>>>+<<<<<+<-]>+<]>[<+>-]>>>>+++[<<<+[-<+]->[-[+[->+]->>>+<<<<+[-<+]->>+<-]>+<]>[<+>-]+[->+]->>-[<<<+[-<+]+>>>>-->+[->+]->>[<<<+>>>-]]<<<[>>>+<<<-]>>>]<<<+[-<+]+<<<<-->+[->+]->>>>>[-[<<+>>>+<-]>+<]>[<+>-]<<<<+++[+[->+]->[-[<<+[-<+]->>>++[->+]->>+<-]>+<]>[<+>-]<<<+[-<+]->>-[+[->+]+>>>>--<+[-<+]->>[<<<+>>>-]]<<<[>>>+<<<-]>>>]+[->+]+<<<<--<+[-<+]->-[>>[-]<<++++++[>++++++<-]>.[-]+<<<]<[>>>[<++++++[>++++++++<-]>.[-]<]<<<[<++++++++[<+++++++++++>-]<.[-]>]<]>>>>+<<++>]>[<+>-]>>]->+[->+]++[-<+]++++++++++.[-]]>]

Try it online! or try the old version with integer input
One day of programming and three days of bugfixing ^^
This uses a few parts of my Game Of Life code. Instead of counting living cells, this counts bombs.
Since input as codepoints is allowed by the general rules, this uses them instead of "readable" integers.
[
Data: colCount, rowCount, {BombCoordinates}, -1 (start of arrays/"soa"), 0, {RowData}
BombCoordinates: bombCol, bombRow
RowData: rowFlag, 0, {CellData}, 0
CellData: cellFlag, cellState, temp, bombCount

rowFlag: 0=EOF, 1=inactive (all cells inactive), 2=active
cellFlag: -1=marker for finding cell (cell to be counted or current cell), 0=EOF, 1=normal
cellState: 0=inactive, 1=normal, 2=bomb
temp: helper to exit if-statements
bombCount: count of neighbor cells that contain bombs
inactive cells or rows will not be printed. They are only used for an easier counting algorithm.
]

#### input values as codepoints ####
,[>,]

#### setup two dimensional array ####
-                   set soa
[<]>>               go to rowCount
++                  add two inactive rows
[                   for each row
  <[<+<+>>-]          copy colCount two times to the next left cells
  <[>+<-]             move one of the copies back to the original cell
  >[>]>[>>[>>>>]>]    go to new row position
  +                   set rowFlag (only 1 while initialization)
  +[-<+]-[<]<         go to copy of colCount
  ++                  add two inactive cells per row
  [                   for each col
    >>[>]>[>>[>>>>]>]   go to new cell position
    +<+                 set cellFlag and cellState = normal
    +[-<+]-[<]<         return to copy of colCount
    -                   decrement
  ]
  >>>-                decrement rowCount
]

#### setup active/inactive flags of cells ####
>[>]>[              for each row
  >>[>>>>]<<<-        set last cell inactive
  >>>>                go to next row
]

#### mark the bombs ####
+[-<+]-[<]>>        go to bombRow
[                   while there are bombRow values left
  [>]>--              set rowFlag of first row = neg 1 (as a marker)
  <<[<]>>             return to bombRow
  [                   for each bombRow
    [>]+[->+]           find first marker after soa
    +                   set rowFlag = 1
    >>[>>>>]>           go to next rowFlag
    --                  make a marker of it
    <+[-<+]-[<]>>       return to bombRow
    -                   decrement
  ]
  >[>]+[->+]          go to selected rowFlag
  +                   set rowFlag = 1
  >>--                set cellFlag of first cell = marker
  <+[-<+]-[<]<        go to bombCol
  [                   for each bombCol
    >>[>]+[->+]         find first marker after soa
    +                   set cellState = 1
    >>>>                go to next cellState
    --                  set it neg 1 (as a marker)
    <+[-<+]-[<]<        return to bombCol
    -                   decrement
  ]
  >>[>]+[->+]         find first marker after soa
  +                   set cellFlag = normal
  >+                  set cellState = bomb
  +[-<+]-[<]>>        go to next bombRow
]

#### setup active/inactive flags of rows ####
>[                  for each row
  +                   set rowFlag = 2 (active)
  >>[>>>>]>           go to next rowFlag
]
<<<<<[<<<<]>>-      set rowFlag of last row = 1 (inactive)

#### count bombs in neighborhood ####
<+[-<+]>>>>[>>>>]>  go to second row
[                   for each row
  -[                  if active
    --                  set it neg 1 (marker)
    <<<<<[<<<<]>>>>     go to cellFlag of first cell in previous row
    --                  set it neg 1 (marker)
    [>>>>]>>>[>>>>]>>>  go to cellFlag of first cell in next row
    --                  set it neg 1 (marker)
    <+[-<+]             return to rowFlag
    ++                  set rowFlag = 2 (active)

    >> >>>>[            for each cell (starting with second)
      >[                  if active
        <--                 set cellFlag = neg 1 (marker)

        # check if cell to the left is a bomb
        < <<                go to cellState of previous cell
        [                   if active
          -[                  if bomb
            >> >>>>+            increment bombCount
            <<<< <              go back to checked cell
            +                   set temp = 1
            <-                  set cellState = 0 to exit if
          ]
          >+<                 increment temp
        ]
        >[<+>-]             restore cellState

        # check if cells on top are bombs
        > >>>               go to temp of current cell
        +++[                do three times
          <<<+[-<+]-          go to next marker to the left
          >[                  if active
            -[                  if bomb
              +[->+]-             return to current cell
              >>>+                increment bombCount
              <<<<+[-<+]->        return to counted cell
              >+                  set temp = 1
              <-                  set cellState = 0 to exit if
            ]
            >+<                 increment temp
          ]
          >[<+>-]             restore cellState
          +[->+]-             go to current cell
          >>-                 decrement temp
          [                   if temp != 0
            <<<+[-<+]           go to marked cell
            +                   set cellFlag = normal
            >>>>--              set cellFlag of next cell = marker
            >+[->+]->>          return to currentCell temp
            [<<<+>>>-]          store value of temp in previous cell bombCount (to exit if)
          ]
          <<<[>>>+<<<-]>>>    restore temp value
        ]
        <<<+[-<+]           go to marked cell
        +                   set cellFlag = normal
        <<<<--              set previous cellFlag = marker
        >+[->+]-            return to current cell

        # check if cell to the right is a bomb
        >>> >>              go to cellState of next cell
        [                   if active
          -[                  if bomb
            <<+                 increment bombCount
            >>>                 go back to checked cell
            +                   set temp = 1
            <-                  set cellState = 0 to exit if
          ]
          >+<                 increment temp
        ]
        >[<+>-]             restore cellState

        # check if cells below are bombs
        <<< <               go to currentCell temp
        +++[                do three times
          +[->+]-         go to next marker to the right
          >[              if active
            -[              if bomb
              <<+[-<+]-       return to current cell
              >>>+            increment bombCount
              +[->+]->        return to counted cell
              >+              set temp = 1
              <-              set cellState = 0 to exit if
            ]
            >+<             increment temp
          ]
          >[<+>-]         restore cellState
          <<<+[-<+]-      go to current cell
          >>-             decrement temp
          [               if temp != 0
            +[->+]          go to marked cell
            +               set cellFlag = normal
            >>>>--          set cellFlag of next cell = marker
            <+[-<+]->>      return to currentCell temp
            [<<<+>>>-]      store value of temp in previous cell bombCount (to exit if)
          ]
          <<<[>>>+<<<-]>>>restore temp value
        ]
        +[->+]          go to marked cell
        +               set cellFlag = normal
        <<<<--          set previous cellFlag = marker
        <+[-<+]-        return to current cell

        # print
        >-[             if bomb
          >>[-]<<         delete bombCount
          ++++++[>++++++<-]>.print "*"
          [-]+            set temp = 1
          <<<             use previous cell bombCount as exitIf
        ]
        <[              else
          >>>[            if bombCount != 0
            <++++++[>++++++++<-]add 48 to get ascii number
            >.              print
            [-]             set number = 0 (for use as exitIf from next cell)
            <               go to temp for exit if
          ]
          <<<[            else
            <++++++++[<+++++++++++>-]<.print "X"
            [-]             delete value (for use as exitIf from next cell)
            >               go to exitIf
          ]
          <               go to exitElse
        ]
        > >>>+          increment temp
        <<++>           set cellFlag = normal
      ]
      >[<+>-]         restore cellState
      >>              go to cellFlag of next cell
    ]
    -               set marker
    >+[->+]         go to next marker
    +               set cellFlag = normal
    +[-<+]          return to marker
    +++++ +++++.[-] print newline
  ]
  >               go to next row
]

APL (Dyalog Unicode), 59 57 54 bytes
With a more flexible input format this could be 39 bytes
{⍉{5⌷,⍵:'*'⋄×r←+/,⍵:⍕r⋄'x'}⌺3 3⊢1@(1↓⍵)⊢0⍴⍨⊃⍵}⊢⊂⍨2|⍳∘≢

Try it online!
The whole structure is a train, first ⊢⊂⍨2|⍳∘≢ splits the input into pairs, then the large dfn is called on the list of pairs:
0⍴⍨⊃⍵ Create a matrix of 0's where the dimensions are given by the first pair.
1↓⍵ all but the first pair
1@(...) at those indices place 1's in the matrix.
{ ... }⌺3 3 apply the left function on each 3×3 neighborhood (padded with zeros):
5⌷,⍵ If the value at index 5 of the flattened neighborhood (the center) is 1, return '*'
×r←+/,⍵ If the sum of the neighborhood is positive, return it as a string ⍕r
Otherwise return 'x'
⍉ transpose the matrix because the order of axis is different in APL and the challenge.

The rigidness of input specs on these old questions is frustrating.  The new norms are so much better.

VBA - 298 chars
Sub m(x,y,ParamArray a())
On Error Resume Next:ReDim b(x,y):For i=0 To (UBound(a)-1) Step 2:c=a(i):d=a(i+1):b(c,d)="*":For e=c-1 To c+1:For f=d-1 To d+1:v=b(e,f):If v<>"*" Then b(e,f)=v+1
Next:Next:Next:For f=1 To y:For e=1 To x:v=b(e,f):s=s & IIf(v<>"",v,"x")
Next:s=s & vbCr:Next:MsgBox s
End Sub

Skipping over errors with On Error Resume Next saved me some characters, but this still isn't nearly as good as some of the other answers. :-/

C++, 230 chars
#import<iostream>
int*p,n,m,x,y,i,j,k,a[999][999];main(){for(std::cin>>m>>n;std::cin>>y>>x;)for(i=2;~i--;)for(j=2;~j--;*p+=i|j&&~*p?:~*p)p=a[x+i]+y+j;for(;k<n*m;std::cout<<char(x?~x?x+48:42:120)<<(j<m)+"\n")x=a[k/m+1][j=k++%m+1];}

-11 bytes thanks to ceilingcat
-15 bytes thanks again to ceilingcat. Truly bigbrain
-14 bytes thanks to ceilingcat and I
-8 bytes thanks to ceilingcat and I
Try it online

05AB1E, 50 bytes
#2ôć¬UPL<s<íXδβ©såXô2Fø0δ.ø}2Fø€ü3}OOJJ'*®ǝ0'x:Xô»

Try it online or verify both test cases.
Explanation:
05AB1E lacks multi-dimensional index builtins and uses 0-based indexing, so we mostly work with the flattened list and lower all indices by 1 (before converting it back to a matrix to calculate the amount of surrounding mines per cell).
#              # Split the (implicit) input-string on spaces
 2ô            # Split it into parts of size 2
   ć           # Extract head; pop and push remainder-list and first pair
    ¬          # Get the first item of this first pair (without popping)
     U         # Pop and store it in variable `X`
    P          # Take the product of this first pair
     L<        # Pop and push a list in the range [0,value)
    s          # Swap so the list of pairs is at the top again
     <         # Decrease each inner value by 1 to make things 0-based
      í        # Reverse each inner pair, to reverse column,row to row,column
        δ      # Map over each reversed and lowered pair:
       X β     #  Convert it from base-`X` to an integer,
               # (which are all flattened 0-based indices of the mines)
          ©    # Store this list in variable `®` (without popping)
           s   # Swap so the [0,value)-ranged list is at the top
            å  # Check for each value whether its in the indices-list,
               # resulting in a list of 0s and 1s, with 1s at the mine-positions
Xô             # Split it into `X`-sized parts to a matrix
  2Fø0δ.ø}     # Add a border of 0s around the matrix:
  2F     }     #  Loop 2 times:
    ø          #   Zip/transpose; swapping rows/columns
      δ        #   Map over each inner list:
     0 .ø      #    Surround it with a leading/trailing 0
  2Fø€ü3}      # Convert it to a matrix of overlapping 3x3 blocks:
  2F    }      #  Loop 2 times again:
    ø          #   Zip/transpose; swapping rows/columns
     €         #   Map over each inner list:
      ü3       #    Convert it to a list of overlapping triplets
  OO           # Sum each inner 3x3 block
    JJ         # Join all these digits together to a single string
      '*®ǝ    '# Replace the digit at the `®`-indices with "*"s
      0'x:    '# Replace all 0s with "x"s
      Xô       # Split it into `X`-sized parts again to a list of rows
        »      # Join it by newlines
               # (after which the result is output implicitly)

time to golf my answer again

The mines in the first test case don't get placed correctly (should be in a diagonal line, not a vertical line).

@DLosc Woops.. Thanks for noticing! Should be fixed now.

It is, but I think you replaced the wrong link. ;)

Vyxal, 42 bytes
⌈⌊2ẇḣ$2+Þm$R(n1ÞȦ)2(3vl∩)ƛƛf4ǔṫß×∑\x$∨}vṅ⁋

Try it Online! (would be 28ish with looser I/O)
⌈⌊                                         # Parse integers from input
  2ẇ                                       # Group into pairs
    ḣ                                      # Remove the first pair (dimensions)
     $2+                                   # Add 2 to each
        Þm                                 # Create a matrix of 0s with those dimensions
          $R(    )                         # Over each remaining coordinate pair (with x and y swapped)
               ÞȦ                          # Place in the matrix
              1                            # A 1
             n                             # At those coordinates
                  2(    )                  # Twice
                    3vl                    # Get all sliding windows of length 3 of each
                       ∩                   # Transpose
                         ƛƛ           }
                           f               # Flatten into a 9-element array
                            4ǔ             # Rotate so the centre (current cell) is at the end
                              ṫ            # Extract the last element (current cell)
                               ß×          # If that is truthy, push a mine
                                 ∑         # Sum to get number of nearby mines
                                  \x$∨     # If 0, replace with x
                                       vṅ⁋ # Concatenate each and join by newlines

Mathematica - 247 chars
s[q_] :=
  Module[{d, r},
    d = ToExpression@Partition[Cases[Characters@q, Except@" "], 2];
    r = Rest@d;
    StringJoin @@@
    ReplacePart[
    Table[ToString@
       Count[ChessboardDistance[{i, j}, #] & /@ Reverse /@ r, 1], {i,d[[1, 2]]},
       {j, d[[1, 1]]}] /. {"0" -> "x"}, # -> "*" & /@ Reverse /@ r] // TableForm]

Examples:
s@"5 5 1 3 3 5 2 4"
s@"3 4 3 1 1 4 2 3 3 2"

Output:

ChessboardDistance computes how far each cell is from a mine, where 1 corresponds to "next to a mine".  The Count of 1's yields the cell's number. Then mines (*) are inserted into array.

David, nice to see another Mathematica user here.  I'll see if I can beat this! :-)

@Mr.Wizard I'll be interested in seeing your solution. Feel free to improve on mine if you like.

Mathematica, 140 139 137
Grid[(ListConvolve[BoxMatrix@1,#,2,0]/. 0->x)(1-#)/. 0->"*"]&@Transpose@SparseArray[{##2}->1,#]&@@#~Partition~2&@@#~ImportString~"Table"&

Writing that in a more readable form:
"5 5 1 3 3 5 2 4"

ImportString[%, "Table"][[1]] ~Partition~ 2

Transpose @ SparseArray[{##2} -> 1, #]& @@ %

ListConvolve[BoxMatrix@1, %, 2, 0]

(% /. 0 -> x) (1 - %%) /. 0 -> "*" // Grid

Elegant! I confess I cannot understand how ListCorrelate[BoxMatrix@1, %, 2, 0] does its magic.

@David I'm glad you (implicitly) asked as that's my favorite part. ListCorrelate effectively overlays the kernel (BoxMatrix@1) at each position in the grid, multiplies, and gives the sum. (ping me in mma chat if you would like an illustration) -- Your comment reminds me that ListConvolve should work here too as it is a kind of mirror image of ListCorrelate and my kernel is symmetric. That will save me a character. :-)

Your code incorrectly generates a mine at (5,5).  "5 5" gives the dimensions of the grid.

@David Thanks.  You're right, but it's only in the white-space version; I somehow lost the 2 in ##2.  I'll fix it now.  ps: How did you come to notice this after so long?

Another minesweeper question, http://codegolf.stackexchange.com/questions/10635/code-golf-functional-minesweeper, recently appeared and I decided to give your solution another look-through.

Vyxal 3 j, 37 bytes
2ẆVḤ\ðYY$v•ÞẠ:Þȯᵛƛ•C]ZᵗZᵛᵛ₳•c[•]0'xr“

Try it Online!
-12 from Using reduce lambdas on zipped list instead of the weird index method.
-1 because i didnt need a map lambda at the end

Python, 192 182 180 chars
I could save some if the input was comma-separated. Then the first line would be d=input() and the length 171 chars.
Having the mine coordinates 0-based rather than 1-based would also help. It cost me 8 chars to overcome.
d=map(int,raw_input().split())
m=zip(d[2::2],d[3::2])
for y in range(d[1]):print"".join((str(sum(abs(a-x-1)|abs(b-y-1)<2for a,b in m)or'x')+'*')[(x+1,y+1)in m]for x in range(d[0]))

Ungolfed version:
d=map(int,raw_input().split())          # Read whitespace terminated numbers into a list of numbers
xsize,ysize = d[:2]                     # The first two numbers are the board size
mines=zip(d[2::2],d[3::2])              # Convert items 3,4,5,6... to pairs (3,4),(5,6) representine mine coordinates

def dist(point,mine):                   # Distance between point (0-based coordinates) and mine (1-based coordinates)
    dx = abs(mine[0]-(point[0]+1))
    dy = abs(mine[1]-(point[1]+1))
    return dx | dy                      # Should be max(dx,dy), but this is close enough. Wrong for d>=2, but returns >=2 in this case.

for y in range(ysize):                  # Print lines one by one
    line_chars = [
        (str(
            sum(dist((x,y),(a,b))<2 for a,b in mines)   # Number of neighboring mines
            or 'x'                                  # 'x' instead of 0
        )
        +'*')                                       # For a single neighbor, we get "1*"
        [(x+1,y+1)in mines]                         # If a mine, get the '*', else the neighbor number
        for x in range(xsize)
    ]
    print "".join(line_chars)

Scala, 280 chars
val n=readLine split" "map{_.toInt}
val b=Array.fill(n(1),n(0))(0)
n drop 2 sliding(2,2)foreach{case Array(x,y)=>b(y-1)(x-1)=9
for{i<-(x-2 max 0)to(x min n(0)-1);j<-(y-2 max 0)to(y min n(1)-1)}b(j)(i)+=1}
b.map{r=>println(r.map{case 0=>"x"case x if x>8=>"*"case x=>""+x}mkString)}

Haskell, 155 bytes
main=interact$f.map read.words
f(x:y:a)=unlines[["x12345678*"!!min((i,j)#a)9|i<-[1..x]]|j<-[1..y]]
p@(a,b)#(x:y:z)=div 9(9^max(abs$a-x)(abs$b-y))+p#z
_#_=0

Try it online!

C++ - 454 chars
This is worse than my VBA answer, which probably means I don't know what I'm doing in C++. However, I am trying to build on what I know of C++, so here it is. If anyone has any suggestions for improvement, I'd be grateful to hear them!
#define Z for(int i=
#define Y for(int j=
#define X d[i][j]
#define W Z 0;i<x;i++){
#define V Y 0;j<y;j++){
#define U cout<<
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
int main(){using namespace std;int x,y,a,b;cin>>y>>x;string c[x][y];int d[x][y];W V X=0;}}while(cin>>b>>a){c[--a][--b]="*";Z a-1;i<=a+1;i++){Y b-1;j<=b+1;j++){if(x>i&&i>=0&&y>j&&j>=0){X=X+1;}}}}W V if(c[i][j]!="*"){if(X>0){U X;}else{U"x";}}else{U"*";}}U endl;}return 0;}

you don't need to return 0. And you can #include<cstdio>,#include<cstdlib>. You can even delete these two includes!. What's more, using name..... is too long, you can use std::cin, std::cout, std::string instead.

@Ray Aye, you're right about the namespace... It's been a while since I put this together, but I'm thinking I had more std:: calls that would have made it more worth it (I think one more string would have done it). Thanks for the info about the #include lines as well. I'm no C++ expert. ;-)

C# (691 Chars)
using System;namespace M{class P{static char C(char[][] g,int r,int c){int n=0;for(int i=r-1;i<=r+1;i++){if(i<0||i>=g.Length)continue;for(int j=c-1;j<=c+1;j++){if((j<0||j>=g[0].Length)||(i==r&&j==c))continue;if(g[i][j]=='*')n++;}}return n==0?'x':(char)(n+48);}static char[][] G(int[] p){char[][] r=new char[p[1]][];for(int i=0;i<r.Length;i++)r[i]=new char[p[0]];for(int i=2;i<p.Length;){r[p[i+1]-1][p[i]-1]='*';i+=2;}for(int i=0;i<r.Length;i++)for(int j=0; j<r[0].Length;j++)if(r[i][j]!='*')r[i][j]=C(r,i,j);for(int i=0;i<r.Length;i++){for(int j=0;j<r[0].Length;j++)Console.Write(r[i][j]);Console.WriteLine();}return r;}static void Main(string[] args){G(new int[]{3,4,3,1,1,4,2,3,3,2});}}}

Non-golfed Version:
using System;
namespace M
{
    class P
    {
        static char C(char[][] g, int r, int c)
        {
            int n = 0;
            for (int i = r - 1; i <= r + 1; i++)
            {
                if (i < 0 || i >= g.Length) continue;
                for (int j = c - 1; j <= c + 1; j++)
                {
                    if ((j < 0 || j >= g[0].Length) || (i == r && j == c)) continue;
                    if (g[i][j] == '*') n++;
                }
            }
            return n == 0 ? 'x' : (char)(n + 48);
        }

        static char[][] G(int[] p)
        {
            char[][] r = new char[p[1]][];
            for (int i = 0; i < r.Length; i++)
                r[i] = new char[p[0]];
            for (int i = 2; i < p.Length; )
            {
                r[p[i + 1] - 1][p[i] - 1] = '*';
                i += 2;
            }
            for (int i = 0; i < r.Length; i++)
                for (int j = 0; j < r[0].Length; j++)
                    if (r[i][j] != '*') r[i][j] = C(r, i, j);
            for (int i = 0; i < r.Length; i++)
            {
                for (int j = 0; j < r[0].Length; j++)
                    Console.Write(r[i][j]);
                Console.WriteLine();
            } return r;
        }
        static void Main(string[] args)
        {
            G(new int[] { 3, 4, 3, 1, 1, 4, 2, 3, 3, 2 });
        }
    }
}

K, 175
f:{g::(y;x)#(x*y)#"x";{.[`g;x;:;"*"]}@'-1+|:'(_(#z)%2;2)#z;{if[~"0"~z;$["x"=g .(x;y);.[`g;(x;y);:;z];]]}.'i,'$s:+/'{"*"=g . x}''{,/((x-1)+!3),\:/:(y-1)+!3}.'i:,/(!x),\:/:!y;g}

.
k)f[5;5;1 3 3 5 2 4]
"xxxxx"
"11xxx"
"*21xx"
"2*21x"
"12*1x"
k)f[3;4;3 1 1 4 2 3 3 2]
"x2*"
"13*"
"2*2"
"*21"

ECMAScript 2019 (Modern Javascript) - 116 bytes
m.map((r,i)=>r.map((c,j)=>c=='X'?c:[,...m].splice(i,3).map(r=>[,...r].splice(j,3)).flat().filter(v=>v=='X').length))

ungolfed version
m.map(
  (r,i) => r.map(
    (c,j) => c=='X' ? c :
      [,...m].splice(i,3).map(r=>[,...r].splice(j,3)).flat().filter(v=>v=='X').length
  )
)

this solution doesn't strictly adhere to the input/output format but demonstrates a succinct algorithm.
example:
https://gist.github.com/missinglink/ee02084cfb523665e8c9d34c24f01537

authors: عبدالمؤمن كاظم


text:
Calculate Network Average Clustering Coefficient
The clustering coefficient of a graph (or network) is a:

measure of degree to which nodes in a graph tend to cluster together

The Wikipedia article gives a much better description of how network average clustering coefficient is calculated from local clustering coefficients than I could give.
The Challenge
Given an adjacency matrix a describing an undirected network (or graph) with no self loops, calculate it's network average clustering coefficient.
Details

You must write a program/function/procedure/code block which calculates the network average clustering coefficient for any undirected graph with no self loops.
The output may only contain the coefficient and nothing else.
You are to assume that your program (or whatever) has access to an adjacency matrix describing the graph through a variable/the stack/file/whatever
You may not use any inbuilt functionality your language may have to calculate clustering coefficients
Shortest code wins

Test Examples
Test inputs and outputs can be found in this pastebin
My solution: GNU Octave, 93 chars
(behind spoiler)

 f=sum(a);c=0;for i=find(f>1)c+=sum(a(t=find(a(i,:)),t)(:))/(f(i)*(f(i)-1));endfor;c/length(a)

Which can be tested here, the matrix needs to be in the format a = [row ; row ; row ; ...]

Python: 192 Characters (not including whitespace)
import itertools
def l(a,i,r):
    s=[b for b in r if a[i][b]]
    k=len(s)
    if k<2:
        return 0
    return 2.0*sum(map(lambda x:a[x[0]][x[1]],itertools.combinations(s,2)))/k/(k-1)
def g(a):
    n=len(a)
    r=range(n)
    return sum([l(a,i,r) for i in r])/n

Example Usage:
>>> g([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
1.0
>>> g([[0, 1, 0, 0, 0, 1, 0, 0],
       [1, 0, 1, 1, 1, 0, 1, 0],
       [0, 1, 0, 0, 0, 1, 0, 0],
       [0, 1, 0, 0, 1, 0, 0, 0],
       [0, 1, 0, 1, 0, 1, 1, 0],
       [1, 0, 1, 0, 1, 0, 0, 1],
       [0, 1, 0, 0, 1, 0, 0, 1],
       [0, 0, 0, 0, 0, 1, 1, 0]])
0.233333333333
>>> g([[0, 1, 0, 0, 1],
       [1, 0, 1, 0, 0],
       [0, 1, 0, 1, 0],
       [0, 0, 1, 0, 1],
       [1, 0, 0, 1, 0]])
0.0
>>> g([[0,1,1,1,0,1,1,1,1,0,1,0,0,0,1,0,0,0,0,1],
       [1,0,0,0,1,0,0,0,1,1,1,1,0,1,0,0,1,0,0,1],
       [1,0,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0],
       [1,0,1,0,0,0,0,1,1,1,0,1,0,1,1,1,0,0,0,1],
       [0,1,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,1,0],
       [1,0,1,0,1,0,0,1,0,0,1,1,0,0,0,1,0,1,1,1],
       [1,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,0,0,1,0],
       [1,0,0,1,1,1,1,0,1,1,0,0,0,0,0,0,1,0,0,0],
       [1,1,1,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,1,0],
       [0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,0],
       [1,1,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0],
       [0,1,0,1,0,1,1,0,0,0,0,0,1,1,1,1,0,1,0,0],
       [0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,1],
       [0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0],
       [1,0,0,1,0,0,1,0,0,0,0,1,1,0,0,1,1,1,1,0],
       [0,0,0,1,0,1,1,0,0,1,0,1,0,0,1,0,0,0,1,1],
       [0,1,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1],
       [0,0,0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0],
       [0,0,1,0,1,1,1,0,1,0,1,0,0,1,1,1,1,0,0,1],
       [1,1,0,1,0,1,0,0,0,0,0,0,1,0,0,1,1,0,1,0]])
0.389888167388
>>> g([[0,1,1],
       [1,0,0],
       [1,0,0]])
0.0

Wooo, an answer! Unfortunately your answer is not quite right. Some graphs (where neighbouring nodes have no edges between them) force division by zero, see the 3rd test example. When division by zero occurs, it is assumed that zero is returned.

@Griffin: I did run the third example and it appears to return zero, as desired.  (I just left it out of the examples here to save room, but I added it back.)

Strange, I got a divide by zero on the third example, but I don't anymore. However I still get a divide by zero error with this example: http://ideone.com/k9e4l

If you fix this, you'll win. No one else seems interested.

Fixed!  Probably not the most elegant way possible, but it should work now.

g([0])... but I didn't put anything in the rules for that edge case :)

source: Stack Exchange

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

sort: votes


text:
Code Golf: Mix the nuts so that none of the same kind are touching
Input:
Input is a randomized array of nuts (in your language), the possible nuts follow. Your program must have a way of representing each kind of nut, such as an integer code. Program must be able to handle any size array of any configuration of nuts.
Possible Nuts:
Kola nut
Macadamia
Mamoncillo
Maya nut
Mongongo
Oak acorns
Ogbono nut
Paradise nut
Pili nut
Pistachio
Walnut

Output:
Output must be the array sorted in such a fashion that there are no adjacent nuts of the
same kind. If this is impossible, the output should be an empty array.
Example Input (simplified):
["walnut", "walnut", "pistachio"]

Example Output:
["walnut", "pistachio", "walnut"]

Solutions may not simply shuffle the array until it becomes unique by chance. The sort employed must be a deterministic one

"Your program must have a way of representing each kind of nut, such as an integer code" why is that? — "may not simply shuffle the array until it becomes unique by chance. The sort employed must be a deterministic one" a shuffle can still be deterministic. Do you just mean to impose a limit on the program's time complexity?

I have to agree with @leftaroundabout forbidding a particular algorithm is silly without a very good reason. One of the most rewarding things about code games like this is exactly the variety of methods that get employed.

@dmckee, I think the requirement that the algorithm be deterministic is reasonable -- if the RNG is faulty or the input fairly long, a nondeterministic solution may fail to terminate.

@boothby. Meh. I'm a particle physicist. Monte Carlo is a important tool in its own right. Moreover, If I choose a fixed PRNG and a fixed seed it is deterministic.

@dmckee, forgive me, but I'm a mathematician, so we may never see eye to eye here.  With a fixed PRNG, it isn't an algorithm because valid inputs result in a nonterminating condition.

@TomDignan, is it OK to have the internal representation of the nut be those strings you passed in?  That portion of the question is quite unclear.

@boothby yes -- represent the nut any way as long as you have the same number of unique nuts

@leftaroundabout -- I may have been overly verbose, as boothby notes, the strings are a fine representation (for any language I can think of) but due to the fact that they take up so many characters, and this is code golf, the use of integer codes is permitted to save chars

I think I found an example that has several solutions, but may cause some answers to fail to find any of them. Can I add it? (5,4,4,3,3,2) perl6 -e 'my @a="aaaaabbbbccccdddee".comb;my @b = @a.pick(*) while @b.squish !== @a;say [~] @b' baedcbdacdecbabaca (3,3,2) may cause them to fail also.

@BradGilbertb2gills makes me want to try perl6

I really wanted to know if it was alright if I added an example that followed that pattern.

An algorithm that finds all permutations without repeating is possible and deterministic.  Add checking for success on each and it is still deterministic.  And, a PRING plus a test that terminates—do you (@dmckee) also call that nondeterministic?  For me, a predictable sequence is deterministic even if infinitely long.

@WGroleau I think you directed that at the wrong person.

You say a PRNG is not deterministic because it doesn't terminate.  I ask whether you say one that does terminate is deterministic.   (I say both are deterministic in that both have repeatable and predictable sequences.)

@WGroleau You've misreading the history. I'm not the one who said that.

oops, looked at the wrong end of the comment.  It was actually @boothby  Mea culpa.

GolfScript, 42 41 37 38 characters
~.`{\`{=}+%1-,}+$.,)2//zip[]*.2<..&=*p

The code expects input on STDIN and prints result to STDOUT, e.g.:
> ["walnut" "walnut" "walnut" "macadamia" "pistachio"]
["walnut" "macadamia" "walnut" "pistachio" "walnut"]

> ["walnut" "walnut" "walnut" "macadamia" "walnut"]
[]

The script became longer than expected but I suppose there is room for improvement.
Edit: The case of a list with a single item costs me 1 character (the best comparison I could come up with is the same as Peter's).

I hadn't sat down to implement this yet, but $.,)2//zip is exactly what I had in mind. My interpretation of the spec was that it could take input on the stack and leave it on the stack, so maybe we should push for clarification.

@PeterTaylor, cool.  Works for me.

This crashes on input ["walnut"] in the compare-the-first-two section.

@PeterTaylor You're right. I'll have to work on that corner case.

GolfScript, 32 chars
~:x{]x\-,}$.,)2//zip[]*.2<..&=*`

Same input and output format as Howard's solution.

I had the same idea on the sort part but didn't code it up yet :-) Good work!

Brachylog v2, 10 bytes
p.¬{s₂=}∨Ė

Try it online!
Brute-force solution. (This is a function, allowed because the challenge does not say "full program".) It's also mostly a direct translation of the spec (the only real subtlety is that I managed to arrange things so that all the implicit constraints arrived in exactly the right places, thus not needing any extra characters to disambiguate them).
Note that this is a generic algorithm for rearranging any sort of list so that it does not have two touching elements; it can handle string representations of the elements, and it can handle integer codes just as well. So it doesn't really matter how the "Your program must have a way of representing each kind of nut, such as an integer code." requirement from the question is interpreted.
Explanation
p.¬{s₂=}∨Ė
p            Find a permutation of {the input}
  ¬{   }     which does not have the following property:
    s₂         it contains a pair of adjacent elements
      =        that are equal
        ∨    {no constraint on what value the equal elements can have}
 .           If you find such a permutation, output it.
        ∨    If no permutation is found, ignore the input and
         Ė     {output} an empty list

Vyxal r, 12 8 bytes
Ṗ‡ÞǓ⁼c¾∨

Try it Online!
-4 thanks to @Steffan
Explanation (old)
I'll update it when I have time.
Ṗ¾wJλ:Ḣ=a¬;c  # Implicit input
Ṗ             # Permutations
 ¾wJ          # With an empty list appended
              # (In case there is no truthy item)
    λ     ;c  # First item such that:
     :Ḣ=      #  Adjacent elements are equal?
        a¬    #  None are true
              # Implicit output

@Jacob it's not shuffling the array until it becomes unique.

9 bytes: Ṗ¾wJ‡ÞǓ⁼c. I think there's a way to remove the ¾wJ and add something at the end to convert 0 to an empty list too.

ah, well, you could do Ṗ‡ÞǓ⁼c¾∨ with r flag

@Steffan thanks, updated

Nibbles, 7 bytes (14 nibbles)
/|``p$/!>>$@!*

Systematically (non-randomly) finds all permutations of the input without adjacent identical nuts, and then returns the first of these (or an empty list if there aren't any).
/|``p$/!>>$@!*
 |               # filter
  ``p            # all permutations of
     $           # the input list
                 # by
      /      *   # fold-by-multiplication
       !         #   zip together
        >>$      #     list without first element
           @     #     the same list
            !    #     are elements equal?
/                # finally get first element

@Jacob This doesn't look like it's shuffling it, at least from the description. Rather, it's iterating over all possible permutations (same with the other answer)

@Jacob JoKing - this indeed iterates non-randomly over all permutations.  It's completely deterministic.

J, 80 characters
]`_:@.(0<2&([:+/=/\))({.~-:@#),((],.|.)~>.@-:@#)<"1;(\:#&.>)(</.])[;.1' ',1!:1[1

Not really in the same league as Golfscript on this one. I suspect there are gains to be made, but the 14 characters needed just to get the list into the program [;.1' ',1!:1[1 is a major handicap.
Basically the program takes in the list, groups similar items together, sorts by number of items in each group descending, and alternates the output between the first half and the second half of the list. The rest if the code gets rid of extraneous items and decides if the list is valid output (outputting infinity _ if it isn't).
Example:
macadamia walnut walnut pistachio walnut

group (</.]):
macadamia walnut walnut walnut pistachio

sort (\:#&.>):
walnut walnut walnut macadamia pistachio

ravel ((],.|.)~>.@-:@#):
walnut macadamia walnut pistachio walnut

Jelly, 14 bytes
Ġz0UẎḟ0ịµẋ⁻ƝẠ$

Try it online!
The last 6 bytes can be removed if we can have undefined behavior for invalid inputs.

Stax, 10 bytes
│éÿ∞å[zàL⌂

Run and debug it
Here's the same program unpacked, ungolfed, and commented.
|T      get all permutations
{       block to filter by
  :g_=  after dropping repeated elements, it's still equal
f       execute filter
|c      terminate and pop if falsy (no match)
hJ      take the first permutation, and join with spaces

Run this one

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

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


text:
Project Euler's "Harshad Numbers"
Project Euler Problem 387 states:

A Harshad or Niven number is a number that is divisible by the sum of its digits.
  201 is a Harshad number because it is divisible by 3 (the sum of its digits.)
  When we truncate the last digit from 201, we get 20, which is a Harshad number.
  When we truncate the last digit from 20, we get 2, which is also a Harshad number.
  Let's call a Harshad number that, while recursively truncating the last digit, always results in a Harshad number a right truncatable Harshad number.
Also:
  201/3=67 which is prime.
  Let's call a Harshad number that, when divided by the sum of its digits, results in a prime a strong Harshad number.
Now take the number 2011 which is prime.
  When we truncate the last digit from it we get 201, a strong Harshad number that is also right truncatable.
  Let's call such primes strong, right truncatable Harshad primes.

Given a number n, determine the first n strong, right truncatable Harshad primes.
Input: An integer, n, where n<50. (This means your program will need to be somewhat efficient.)
Output: The first n strong, right truncatable Harshad primes, with some form of whitespace in between each value.
Reference Table:
The first 20 strong, right truncatable Harshad primes are:
1-10:181 211 271 277 421 457 631 2011 2017 2099
11-20:2473 2477 4021 4027 4073 4079 4231 4813 4817 6037 8011
Shortest code wins. Good luck!

is 1117 not a strong, right truncatable Harshad prime?

No, because 11 is not divisible by 2. (111/3=37, truncate, 11/2=5.5)

Python 188 bytes
r=range(10)
h=zip(r,r)
w=input()
p=lambda n:all(n%~i for i in range(1,int(n**.5)))%n
while w:
 n,s=h.pop(1)
 for i in r:
    d=s+i;i+=10*n
    if i%d<1:h+=[(i,d)]
    if p(n/s)and p(i):print i;w-=1

This could be made shorter, but my primary concern was efficiency. This code maintains a list of the 'right truncable harshad numbers', as well as the their digital sum, and then uses this list to extend itself by one digit iteratively, allowing only new truncable numbers. I don't see any way to obtain the efficiency required without maintaining such a list. Runtime for n<=50 is less than one second.
A less efficient version, which calculates everthing as it goes (139 bytes, has an acceptable runtime for n<=31):
s=9
w=input()
while w:
 n=s=s+2;x=2;f=0
 while n>9:n/=10;z=sum(map(int,`n`));x-=n%z;f=f or(n/z<3)+n/z
 if(1<<s)%s==(1<<f)%f==x:print s;w-=1

the first version will run indefinitely if w>10

More specifically, it will run indefinitely for the values [3, 8, 11, 13, 15, 18, 21, 24, 30, 38]. Any other value will terminate correctly. This could be corrected by changing the while condition to w>0, in which case it would display an extra value for each of these cases.

Python, 204
def p(x):
 i=2
 while x%i:i+=1
 return i==x
def h(x):s=sum(map(int,`x`));return[0,x/s][x%s<1]
f=lambda x:x<10or h(x/10)and f(x/10)
n=input()
i=99
while n:
 i+=2
 if f(i)and p(h(i/10))and p(i):print i;n-=1

K, 190
w:{i:0;l:();while[x>#l;if[{$[x>9;$[{&/(h:{a=_a:(d:{x%+/"I"$'$x})x})'{-1_"I"$_[-1]\[$x]}x}q:"I"$-1_$x;$[{(h x)&(p:{(x>1)&&/{x-y*x div y}[_x;2_!_x]})d x}q;$[p x;1;0];0];0];0]}i;l,:i];i+:1];l}

.
k)w 10
181 211 271 277 421 457 631 2011 2017 2099

An easier to read version of the unintelligible one-liner above:
d:{x%+/"I"$'$x}                                     /divide number by sum of digits
h:{a=_a:d x}                                        /test for harshad number
t:{-1_"I"$_[-1]\[$x]}                               /right-truncate a number recursively
r:{&/h't x}                                         /right-truncatable harshad
p:{(x>1)&&/{x-y*x div y}[_x;2_!_x]}                 /isPrime
s:{(h x)&p d x}                                     /strong harshad
m:{$[x>9;$[r q:"I"$-1_$x;$[s q;$[p x;1;0];0];0];0]} /strong right truncatable harshad prime
w:{i:0;l:();while[x>#l;if[m i;l,:i];i+:1];l}        /print the first n harshad srthps

Jelly, 22 bytes
DṖSḍḌƊÐƤP$×Ḍ÷SƊẒ$Ɗ×Ẓµ#

Try it online!
This really should be shorter :/
How it works
DṖSḍḌƊÐƤP$×Ḍ÷SƊẒ$Ɗ×Ẓµ# - Main link. No arguments
         $×      Ɗ× µ# - Read an integer, n, and return the first n integers for which the following three conditions are true:
                   Ẓ   -   1. The integer is prime
DṖSḍḌƊÐƤP              -   2. The integer is a right truncatable Harshad number:
D                      -      Convert to digits
 Ṗ                     -      Remove the last one
     ƊÐƤ               -      Generate the suffixes of the digit list, then, for each:
  S                    -        Take the sum of the suffix
    Ḍ                  -        Convert the suffix back to a number
   ḍ                   -        Does the sum divide the number?
        P              -      Is this true for all the suffixes?
DṖ         Ḍ÷SƊẒ$      -   3. The right truncated integer is a strong Harshad number:
D                      -      Convert to digits
 Ṗ                     -      Remove the last digit
                $      -      Group the previous two commands together:
              Ɗ        -        Group the previous three commands together:
             S         -          Take the sum of the digits
           Ḍ           -          Convert back to an integer
            ÷          -          Divide the integer by the sum
               Ẓ       -        Is this number prime?


text:
Name the poker hand
Name the poker hand
Given five cards, output the name of the poker hand, which will be one of:
High card
One pair
Two pair
Three of a kind
Straight
Flush
Full house
Four of a kind
Straight flush
Royal Flush

If in doubt, refer to the rules at http://en.wikipedia.org/wiki/List_of_poker_hands.
Input
5 cards from either stdin or commandline arguments.
A card is a two letter string on the form RS, where R is rank and S is suit.
The ranks are 2 - 9 (number cards), T (ten), J (Jack), Q (Queen), K (King), A (Ace).
The suits are S, D, H, C for spades, diamonds, hearts and clubs respectively.
Example of cards
5H - five of hearts
TS - ten of spades
AD - ace of diamonds

Example of input => desired output
3H 5D JS 3C 7C => One pair
JH 4C 2C JD 2H => Two pair
7H 3S 7S 7D 7C => Four of a kind
8C 3H 8S 8H 3S => Full house

Rules
Shortest code wins
Edit
Looking great so far! I can't really verify all the answers, since I don't know these languages very well and don't have compilers/interpreters for all of them, but I suspect that not everyone have thought about that Aces can be both the highest and the lowest cards of a Straight (flush).

There is a vaguely related oldie on Stack Overflow.

Are we allowed to capitalize (or not) hand names as we please?

Mr.Wizard, sure.

GolfScript (209 208 207 206 200 199 197 196 chars)
3/zip:^0={10,''*"TJQKA"+?}/]:?15,{?\{=}+,,}%2,-$6,14.),++@$/):|;[!!2*^1=.&,(!+5+]or{/}*'Full house
Two pair
One pair
ThreeKFourKHigh card
Flush
Straight''K'/' of a kind
'*n/~|1$"Royal"if" "+2$+](=

I'm exploiting the offered freedom to tweak capitalisation: my Straight Flush and Royal Flush both capitalise Flush in order to reuse the word from the simple flush.
Note: some earlier versions were buggy: they only supported full house when the pair was of lower value than the pair royal. They can be corrected by replacing the space separating - 0 with a $.
Demo

Now that's a golfed program! I've been looking for ways to shorten it, but can't come up with anything. Using .& to find the distinct chars in a string is a very useful trick.

@w0lf, that's a fairly standard trick. Howard uses it too in his solution.

Came up with an answer of my own :)
Python - 312 301 298
R,K,F,S,g=' 23456789TJQKA2345A',' of a Kind','Flush','Straight ',sorted
s,r=''.join(g(raw_input(),key=R.find)).split()
n,m=g(map(r.count,set(r)))[-2:]
print[[F,[0,'High Card','TOwnoe'[n&1::2]+' Pair',['Full House','Three'+K][n&1],'Four'+K][m]],[[S,'Royal '][r[0]=='T']+F,S]][r in R][len(set(s))>1]

Creates a 2x2 list where the indices of the two dimensions are boolean checks for flush and straight. In case of both, we check if it's a royal flush or just a straight flush. For not flush and not straight, we check for the other hands: m and n holds the highest and second highest amount of same-rank cards; the names of the hands are stored in a list with indices according to m. Sub-checks within this list's values are done with n to seperate one pair from two pair, and three of a kind from house.
Edit: Thanks Nolen Royality for a total of 20 characters saved!

... and beat mine.

Love the new solution, 312 characters is pretty tiny.  Very clever method of dealing with one vs two pairs :D

Thanks :) You're welcome to try it if you want. But you're maybe not using any similar variable as mine m and n. Checking this and watching your code again, I just realized I can shave off some more on the original one ^^

Couldn't you lose another 8 chars by switching m,n=g([c.count(x)for x in set(r)]) to m,n=g(map(c.count,set(r)))?

Woah, you are darn right I could :D Don't know why that slipped my mind. Good catch, thanks!

Ruby 1.9 (427 359 348 338 296 292 289)
EDIT: Fixed to work with low aces.
EDIT: Incorporated @je-je's fixes / improvements
o,p=%w(flush straight)
f=/1{5}|^1+0+1$/
s=[0]*13
puts Hash[*$*.map{|c|s['23456789TJQKA'.index c[0]]+=1;c[1]}.uniq[1]?[f,p,?4,'four'+a=' of a kind',/^[^1]+$/,'full house',?3,'three'+a,/2.*2/,'two pair',?2,'one pair',0,'high card']:[/1{5}$/,'royal '+o,f,p+' '+o,0,o]].find{|r,y|s.join[r]}[1]

The basic idea is to build up an array of the quantity of card in each rank, concatenate the digits into a string, and then run regular expressions to see which hand shape fits.  We count the number of distinct suits to determine whether to check it against the different flushes (flush, straight flush, royal flush) or to the other shapes (everything else).
Takes the cards as separate command-line args, like so:
>ruby poker-hand-golf.rb 3H 5D JS 3C 7C
one pair

This incorrectly identifies AH 3H 4H 5H 6C as a straight. Replacing line 2 with f=/1{5}|^1+0+1$/ fixes this. The full house matching regex can be golfed to /^[^1]+$/.

For ease of reference: try je je's failing testcase online

Thanks, incorporated both those changes  10 years, how time flies!

C, 454 characters
#define L for(a=1;a<6;a++)for(b=0;b<13;b++)
#define U u[b+6]
#define R(x,y) if(x)puts(#y);else
b,f,r,h=0,s=0,u[20]={0};main(int a,char**v){L U+=v[a][0]=="23456789TJQKA"[b];f=v[1][1];L{if(v[a][1]!=f)f=0;u[a]+=a==U;if(b>7)h+=U;if(a*13+b<64||!U)r=0;else if(++r==5)s=1;}R(f&&h==25,Royal flush)R(f&&s,Straight flush)R(u[4],Four of a kind)R(u[3]&&u[2],Full house)R(f,Flush)R(s,Straight)R(u[3],Three of a kind)R(u[2]==2,Two pair)R(u[2],One pair)R(h,High card);}

Run from command line with cards as arguments, e.g. ./a.out 8C 3H 8S 8H 3S
Expanded version, with comments:
#define L for(a=1;a<6;a++)for(b=0;b<13;b++)
#define R(x,y) if(x)puts(#y);else
#define U u[b+6]
b,f,r,h=0,s=0,u[20]={0};
main(int a,char**v){
    // card usage - u[6..]
    L U+=v[a][0]=="23456789TJQKA"[b];
    // NOTE: lets expand the inner body of the loop in the answer so this looks more sane:
    // flush
    f=v[1][1];L if(v[a][1]!=f)f=0;
    // count of usages - u[0..5]
    L u[a]+=a==U;
    // high cards x5
    L if(b>7)h+=U;
    // straights
    L if(a*13+b<64||!U)r=0;else if(++r==5)s=1;
    // display
    R(f&&h==25,Royal flush)
    R(f&&s,Straight flush)
    R(u[4],Four of a kind)
    R(u[3]&&u[2],Full house)
    R(f,Flush)
    R(s,Straight)
    R(u[3],Three of a kind)
    R(u[2]==2,Two pair)
    R(u[2],One pair)
    R(h,High card);
}

Edits:

Saved 12 chars by combining and reusing loops.
Saved 9 chars by inlining string constant.
Saved 19 chars by using stringification in macro, nasty..

Do h>24 and u[2]>1 work as well as h==25 and u[2]==2? And why is the output of High card conditional on h? What is h if the ranks are, say, 7 6 5 4 2?

K, 294 295
d:{F:"Flush";S:"Straight ";P:" Pair";K:" of a kind";$[(f:1=#?,/-1#'c)&("AJKQT")~a@<a:,/j:1#'c:" "\:x;"Royal ",F;f&s:(4#1)~1_-':a@<a:,/(("A23456789TJQKA")!1+!14)@j;S,F;4=p:|/#:'=j;"Four",K;(2;3)~u:a@<a:,/#:'=j;"Full House";f;F;s;S;3=p;"Three",K;(1;2;2)~u;"Two",P;(1;1;1;2)~u;"One",P;"High Card"]}

.
k)d'("TS JS QS KS AS";"3S 4S 5S 7S 6S";"JC JH KS JD JS";"JC JH 2S JD 2C";"2C 9C TC QC 6C";"8C 5D 9H 6C 7D";"8C 8D 9H 8S 7D";"8C 8D 9H 2S 9D";"8C 8D 4H 2S 9D";"3C 8D 4H 2S 9D")
"Royal Flush"
"Straight Flush"
"Four of a kind"
"Full House"
"Flush"
"Straight "
"Three of a kind"
"Two Pair"
"One Pair"
"High Card"

edit: Added 1 char for Ace-low straights

Mathematica, 365
Here is my take on David Carraher's answer.
Shown with white space for some readability.
If[
  a = Characters;
  x = Thread;
  r = Range;
  d = Sort[a@StringSplit@# /. x[a@"23456789TJQKA" -> 2~r~14]];
  {t, u} = Sort[Last /@ Tally@#] & /@ x@d;
  c = First /@ d;
  f = u == {5};
  S = "Straight";
  c == r[b = d[[1, 1]], b + 4],
  If[f,
   If[c == 10~r~14, "Royal Flush", S <> " flush"], S],
  If[f, "Flush",
   Switch[t,
    {_, 4},    "Four of a kind",
    {2, 3},    "Full house",
    {__, 3},   "Three of a kind",
    {_, 2, 2}, "Two pair",
    {__, 2},   "One pair",
    _,         "High card"]
  ]
] &

One line version:
If[a=Characters;x=Thread;r=Range;d=Sort[a@StringSplit@#/.x[a@"23456789TJQKA"->2~r~14]];{t,u}=Sort[Last/@Tally@#]&/@x@d;c=First/@d;f=u=={5};S="Straight";c==r[b=d[[1,1]],b+4],If[f,If[c==10~r~14,"Royal Flush",S<>" flush"],S],If[f,"Flush",Switch[t,{_,4},"Four of a kind",{2,3},"Full house",{__,3},"Three of a kind",{_,2,2},"Two pair",{__,2},"One pair",_,"High card"]]]&

Nice. You even found space to save in the pattern matching.  E.g. _ instead of {_,_,_,_}

Nice solutions, both of you. For the sake of character count, I think the "Pair" should be named "One Pair", even though it sounds a bit bad, since that is what I posted and others have implemented.

@Daniero Thanks.  I'll fix the name.

Python 334, 326 322 Characters
p,f,l,t,o=" pair"," of a kind"," Flush","Straight","A23456789TJQK"
v,u=zip(*raw_input().split())
s=''.join(sorted(v,key=o.find))
print{5:"High card",7:"One"+p,9:"Two"+p,11:"Three"+f,13:"Full house",17:"Four"+f,23:t,24:l[1:],25:t,42:t+l,44:"Royal"+l}[(sum(map(v.count,v)),24)[len(set(u))<2]+((0,20)[s=="ATJQK"],18)[s in o]]

I know that last one liner is getting pretty unreadable, I'll put up a non-golfed version when I'm happy with with my solution.

Mathematica - 500 494  465 chars
This solution is based on a poker demonstration by Ed Pegg, Jr. In this version, the cards are treated internally as numbers in Range[2,14]
v[x_] := Block[{d, t, c, f, s},
 d = Sort@ToExpression[Characters[ImportString[x, "Table"][[1]]] /. {"T" -> 10, "J" -> 11, "Q" -> 12, "K" -> 13, "A" -> 14}];t = Sort /@ Map[Length, Split /@ Sort /@ Transpose@d, {2}];c = d[[All, 1]];f = (t[[2]] == {5});s = c == Range[b = d[[1, 1]], b + 4];
If[s,
 If[f, If[c == 10~Range~14, "royal flush", "straight flush"],"straight"],
 If[ f, "flush",
Switch[t[[1]],
 {1, 4}, "four of a kind",
 {2, 3}, "full house",
 {1, 1, 3}, "three of a kind",
 {1, 2, 2}, "two pair",
 {1, 1, 1, 2}, "one pair",
 {1, 1, 1, 1, 1}, "high card"]]]]

Sample inputs, outputs:

Notes:
f: flush
c: cards (without suit)
s: straight
t: {cards, suites}
d:

Nice, but how do you get two pair out of JH 4C 2C JD TH?

You are correct. There is an error that arose when I joined some components together into a pure function. I'll track it down.

@Daniero The issue you raised has been addressed.

David, there is a lot of room to compress this.  May I?

@Mr.Wizard Be my guest. I'll watch and learn.

Answer posted.  Thanks for letting me use your method; it's a good deal shorter than the one I started with.

David, I just re-read my comment above and it sounds like I was asking to compress your answer, not post another one.  I'm happy to do that instead!  Let me know which you prefer.

You may post another one or compress mine. Chances are, your rewrite will introduce new routines, in which case you may wish to post separately.

@Mr.Wizard And if you want to borrow ideas from my post for your solution, go right ahead.

GolfScript, 258 250 characters
3/zip~;.&,(!\{"23456789TJQKA"?}%$.(\{.@- 8%}%\;"\1"-!\.1/.&{1$\-,}%1.$?)"Four"" of a kind":k+{.,2="Full house"{.2\?)"Three"k+{.3-,({.3\?)"One pair"{;"Straight":?;2$2$&{(8="Royal"?if" flush"+}{;?{"Flush""High card"if}if}if}if}"Two pair"if}if}if}if])\;

The program expects input on STDIN as given above and outputs to STDOUT. You may test the code yourself.
> 8C 3H 8S 8H 3S
Full house

> 8C 7H 6S TH 9S
Straight

> AH 3H 4S 2H 6S
High card

Edit: Incorporated w0lf's suggestions.

Nice solution! You can save 3 chars by putting " of a kind" in a variable, because it's used twice.

it also works with "Straight"

@w0lf Thank you. I added your suggestions to the code.

I think there's a subtle bug with the detection of Straights: AH KH 2C 3H 4H is considered a Straight, but should be High card.

@w0lf Hmmm, I have to think about that one...

Factor + poker, 16 bytes
string>hand-name

Try it online!


text:
Sort, with your hands tied behind your back
The problem is very simple: write a program that accepts a single unsigned integer from the command line, and prints out that many random numbers on the standard output, in ascending order.
For example:
input:
5

output (you can use any type of whitespace):
557
9424
19212
32293
39135

However, you are not allowed to define any variables. Any at all.
Score is given by code length, shortest wins, and by up-votes if equal.

The random numbers can be anything generated by a reasonable pseudo-random generator with a uniform distribution: for example, integers at least 8 bits long (no cheap "0 0 0 0 0 1 1 1 1 " one bit solutions, please), or real numbers (e.g. float) between 0 and 1.
In dynamically typed languages, the fist assignment counts as definition in our context, so no cheap Matlab solutions, please :)

Is it allowed to use library functions for generating the random numbers?

Yes, it is. Just be careful where you store the results.

I can hardly refrain from posting the 6 chars GolfScript solution: ~[4]*p.

Lots of languages require you to define variables to take an input. Are we allowed to use this variable?

::doffs moderator hat:: To my mind this relies on a pointless distinction without a difference in which some bits of storage are dubbed "variables" and others are dubbed "not variables". You're fooling yourself if you think that anything interesting is happening here. See another equally silly example in http://codegolf.stackexchange.com/questions/2027/implement-a-sorting-algorithm-with-no-change .

@dmckee: Yes, I should have limited it to "C or derived languages". I remember some very nice IOCCC winners using extreme measures (like main calling itself recursively and overwriting itself, and other self-modifying programs) and I was expecting to see at least a few solutions such as those.

are we allowed to use predefined variables (variables built into the language itself)?

Do any languages have a fist assignment?

In Commodore Basic, it's impossible, because input HAS to be stored in a variable.

J, 8 characters
If we can take the number of numbers to be generated at the end of the program like the Q solution, then:
/:~256?~

Example:
   /:~256?~8
18 21 91 201 212 226 246 253

If not, then taking input from the keyboard requires another 8 characters:
/:~256?~".1!:1[1

Q, 10
{asc x?1f}

.
q){asc x?1f}5
`s#0.08724017 0.1024432 0.2310108 0.2560658 0.8671096

Oh, I should have expected this. I should have placed a restriction so that such an easy language (for the problem) should not be allowed. Anyway, congratulations, I think you won! (I will wait a few days with accepting the answer, so that others can gather reputation too, with their painfully clever C++, Javascript and similar solutions)

Do implicitly defined variables count?!

Perl - 28 26 20 chars
say sort map rand.$/,1..<>
I realized the sorting isn't unnecessary, we only need random numbers in ascending order. rand will return a real in [0,1), so just add our iteration counter to each rand result.
say$_+rand for 1..<>

or
map{say$_+rand}1..<>

GolfScript, 14 chars
~{9.?rand}*]$`

Generating random numbers in GolfScript takes quite many characters, especially if you want to pick them from a reasonably large range.  Sorting the list takes only one char ($), though, and needs no variables.
Same code de-golfed and with comments added:

~            # eval input string, turning it into a number
{            # define a code block:
  9.? rand   #   push a random number between 0 and 99-1 onto the stack
} *          # execute the previous code block as many times as the input number indicates
]            # collect the random numbers off the stack into an array
$            # sort the array
`            # un-eval the array for output

Ruby, 42 34
puts (1..gets.to_i).map{rand}.sort

This could probably be made smaller, but don't blame me - I don't even know Ruby. Also, that whitespace after puts is significant. Silly language ;)

I think you can get rid of the .join bit and use p instead of puts to save around 11 characters.

@Gareth: Thanks! I can't use both, though, because p prints it in a list representation.

Bash, 45 characters
eval `yes 'echo $RANDOM;'|head -n$1`|sort -n

Put in a file and run sh file.sh 25 or replace $1 by any number

Octave / MATLAB, 23
sort(rand(input(""),1))

C, 108 chars
You wanted a C (or derived) answer, so here's one.
Gets the number as the first parameter.
Works successfully with numbers up to 10 or so. With larger numbers, it usually overflows the stack (due to my awful algorithm).
f(x,m,r){x&&f(x-(r>m),r>m?printf("%d\n",r),r:m,rand());}
main(c,v)char**v;{srand(time(0));f(atoi(v[1]),0,0);}

R, 19/43(TRUE random) characters
sort(runif(scan()))

Just for fun, selecting TRUE random numbers:
library(random);sort(randomNumbers(scan()))

Scala, 44:
(1 to readInt)map(util.Random.nextInt)sorted

Python, 73 characters
import sys,random
print sorted(eval("random.random(),"*int(sys.argv[1])))

Hopefully imports don't count as defining variables.

random and sys do count as variables unfortunately (<class: module>)

Haskell (102 / 71 chars)
As a proper program (102 chars)
import Random
import List
main=getLine>>=(\n->getStdGen>>=(print.sort.take n.randomRs(0,256*n))).read

Or in GHCi (71 chars)
:m Random List
getLine>>=(`fmap`getStdGen).(sort.).(.randoms).take.read

JavaScript, 85 bytes
n=>{o=[];for(i=[];i.length<n;i.push(1))o.push(Math.random());return o.sort().join` `}

In JavaScript, arrays are objects, not variables.

Java 8, 96 bytes
Because Java is obviously the right tool for this code-golf! [/sarcasm]
n->java.util.stream.Stream.generate(Math::random).limit(n).sorted().forEach(System.out::println)

This is a Consumer<Long> or anything that can be implicitly cast to long. Prints random doubles.
n->                                 // Given an input n
   ...Stream.generate(Math::random) // Generate an infinite stream by calling Math.random()
   .limit(n)                        // Limit the stream to n elements
   .sorted()                        // On the sorted stream
   .forEach(System.out::println)    // Print each element on its own line


text:
Mouse in a room
There is a mouse in a room, in the top-left corner. It can move up, down, left, or right, and the mouse cannot go through any cell in the room twice. Given this, return all the possible paths in which the mouse will visit every square.
Input: Two integers m and n, which represent the m x n room. m<9, n<9.
Output: The m x n room, with ^<>v noting the direction the path goes. Each line of the room will be seperated by a newline, and each room will be seperated by one newline. The last room the mouse enters will be noted by a dot.
v > v .
v ^ v ^
> ^ > ^

next room goes here...

Test Cases:
Input: 2 3, output:
v > v
> ^ .

> > v
. < <

v . <
> > ^

Shortest code wins.

Is there any restriction about the very last step? Since the mouse already entered each cell, any of the four directions would be ok.

@Howard: Whoops! The mouse can only go through cells once.

So that means that the last step must go "outside" of the grid? Because the very last example in your test cases does not fulfill this rule. (should be v^<, >>^ then)

@Howard: Ok, I see what you are getting at now. The last step is unrestricted.

I edited your question to improve the example output formatting. While doing so, I also moved the dot in the last example output room, since it appeared to be misplaced. (The mouse cannot end its path in the upper left corner, since that's where it started.) Please correct me if I made any mistakes.

@IlmariKaronen: That's a much better output. Thanks!

GolfScript, 146 137 characters
~:h\:w*:s(4\?,{[[0.]{\.4/\4%@[0$"<^v>"3$=]@2*)@[~2$3/+(\@3%+(\]@\}s(*[\;46]].{.0=.~0(>\0(>@~h<\w<&&&\0=~w*+*}%$s,={${1=}%h/n*n+n+}{;}if}%

The code shows a very direct implementation in GolfScript. Therefore, I suspect that there is plenty room for improvement. Be aware that the algorithm is really slow if you try it on anything larger than 3x3 or 2x4. I decided to put a . for the last position since any direction would be allowed there (the mouse already entered each cell and the last step is irrelevant).
Example:
> 2 4
>>>v
.<<<

v.<<
>>>^

v>>v
>^.<

v>v.
>^>^

Edit: Minor changes.

I like your dot idea. I will add that into the rules

Python, 296 269
With so many suggestions from others, I decided to make this a community solution.  Tabs have been replaced with 4 spaces.
a=[-1,0,1,0];d='<^>v.'
def r(x,y):
 if G.values().count(4)<2:
    for i in n:print''.join(d[G[j,i]]for j in m)
    print
 for i in range(4):
    X=x+a[i];Y=y+a[i-1]
    if 4==G.get((X,Y)):G[x,y]=i;r(X,Y);G[X,Y]=4
m,n=map(range,input())
G=dict(((i,j),4)for i in m for j in n)
r(0,0)

Example
$ python paths.py
5,2
>>>>v
.<<<<

v>>>v
>^.<<

v>v>v
>^>^.

v>v.<
>^>>^

v.<<<
>>>>^

By three newlines, I meant \n for the end of the first room, \n to seperate them, and... I'm not sure why there's a third. You only need one newline now.

@beary605 w00, saved 6 characters!

You could save a few characters with m,n=map(range,input()). It would mean you could use for i in m rather than for i in range(m).

Also an additional two chars by swapping up and down ('<^>v') and then X=x+a[i];Y=y+a[i-1].

Small changes: if(X,Y)in G and'.'==G[X,Y] -> if'.'==G.get((X,Y)), print''.join(...); print -> print''.join(...)+'\n' and substitute '.' with a variable.

Mathematica 347  315 chars
Very slow for all but the smallest arrays. This is because the solution is overly general, treating the paths as Hamiltonian Graphs rather than something more specific like a grid.
Anyway, here's the code:
Needs["Combinatorica`"]
p=ReplacePart;
q[l_,{},s_]:=p[s,l->"."]//Grid
q[l_, d_,s_]:=q[l+d[[1,1]], Rest@d,p[s,l:>d[[1,2]]]]
f[r_,c_]:=Column[q[{1,1},Differences[#]/.{-1-> {{0,-1},"<"},1-> {{0,1},">"},c-> {{1,0},"v"},-c-> {{-1,0},"^"}},ConstantArray[0,{r,c}]]&/@Cases[HamiltonianPath[GridGraph[c,r],All],{1,__}],Spacings->{0,3}]

Example (I reformatted the output into a table):
"4 4"
f@@ImportString[%,"Table"][[1]]


text:
Conway's Hello World
It is often said, that all programmers should be able to write a "hello world" program in any programming language after a few glances on that language (And quicksort after a few more glances).
As the Conway's Game of Life is Turing complete (so it qualifies as a general-purpose programming language), the problem is self-explanatory:
Create a "Hello World!" application using only Conway's Game of Life!
The only valid entry is an initial state for the Conway's Game of Life, which:

does not contain any recognizable shape resembling the text "Hello World!"
will contain a recognizable shape resembling the text "Hello World!" within a reasonable number of cycles (it should not run for more than a couple of minutes on a good PC - this enables billions of cycles and should be enough)
the area where the "Hello World!" text will appear should be empty in the initial state! (Otherwise the problem would be way too easy) If no one manages to do it, we might reduce this requirement to "mostly empty"

Scoring:
The winner will be based on the number of upvotes in approximately one week after the first valid submission.
Guidelines for voting:

more elaborate and beautiful output should be worth more
output which is stable over many cycles should be worth more than one which fades away to be unrecognizable in the next cycle.
a solution locked into a perpetual cycle, or starting from an interesting pattern is worth the most, because it proves intelligent design of the state, and not just random trial and error with a reverse simulation.

The entry should be in a format readable by at least one of the notable simulators or an online simulator which the answerer links to. Links (to an animation or a simulator set to the initial state) are also accepted, even encouraged. If the output is not visible within a few cycles, the entry should specify after which cycle will the result be visible.

Edit:
There can be some slight tolerance in the phrase to be generated. It can be "Hello, World!", "hello, world" "HELLO WORLD!" etc.

shouldn't there be a comma somewhere in that phrase?

@ardnew: Which phrase?

the phrase to be generated: Hello, world!

@ardnew: thanks, I edited an addendum. I deliberately left some slight vagueness, because ultimately the voters decide. If you think that you did not directly violate one of the main rules, and that the voters will like your interpretation of the minor details, feel free to do it in any way you wish!

All programmers should be able to write a "hello world" program in any programming language after a few glances on that language? Really?

@leftaroundabout: Interesting idea for the next contest :)

https://github.com/tlrobinson/life-gen/

You can use my simulator (imports RLE and Plaintext). It's not good for developing, but at least it runs arbitrary big patterns at decent speed. I can also upload patterns and make them linkable if requested

The one who made this surely can do it.

My first attempt to this, a relatively simple solution. It fires a couple of glider barrels. Each pair of gliders turns into a block, which then form the text. This process takes about 16000 generations (you can set a frame skip or use the superstep button in my simulator).
Direct Link. Move around with right mouse, zoom with mouse wheel.
Link to .rle file (also works with Golly)
Image of the pattern 32:1:

If you have a canvas-supporting browser and don't see the starting pattern, zoom out with the scroll wheel. Took me a while to work that out.

Excellent! I was expecting you to post a solution to this challenge after I've seen http://codegolf.stackexchange.com/a/5946/3527 and your website.

@w0lf creating a pattern is a very different kind of challenge than simulation. But yeah, I'm having fun with this

Congratulations! Strange, that no one took the courage to submit another solution. Actually, if there was no solution posted, I would have done something very similar (gliders converging to form blocks), although much smaller and less detailed. May I ask how you did it? Generated with a program, or calculated the positions manually?

@vsz The pattern is generated from a small python script. I think one week might have been a short deadline for some people (that's why nobody else tried)

This made my day. thank you.

Wow, that is so cool!

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


text:
Lenient typing test
A typing speed test loads up a dictionary of words, and gives you one to type: pinball. You,  with your fast but inaccurate fingers, type in pinbnal. Darn it!
Make a program that will print out a random word from a dictionary, then ask for the user to type this word back, and finally return whether or not they got the word right. The catch is: the program must accept minor typos.
Accept a typo if it has only one of the following:

one letter is repeated in the input 1 or 2 more times. Only accept the letter if it is directly adjacent to a letter it is next to.
one letter in the word is repeated 1 time.
2-4 of the letters in the input are scrambled.

Some acceptable typos of the word pinball are:
pingball pinbala pinbanll
Some unacceptable typos:
pibnannl maxwell pinbalgl
Shortest code wins. Good luck.

an ingteresring undereretanding ohf what a minoe typpe is... what exactly does "scrambled" include, apparently it's not just swapping letters?

e.x. water -> waert (ert is scrambled ter) or wtrae (trae is scrambled ater)

But what's pinbala or pinbnal then? The second l is missing completely in both cases.

And pingball adds a new letter - it's fundamentally the same error as pinbalgl.

I've fixed the parameters to fit my examples.

This sounds like a job for Damerau-Levenshtein Distance!

I don't see which of your accepted typos includes adding a letter, and why 'pingball' is acceptable while 'pinbalgl' is not. -1 until fixed, sorry.

can you specify a dictionary, or should i load that as a local file (/usr/share/dict/words¿?) and take the 980 kilobytes off my score?

usually asking people to fill-in-the-blank about local files/dictionaries is a bad idea, because my dict/words has some modifications ;)

@ghosts_in_the_code you know this question is underspecified, right?

Mathematica 179
Edit: As Primo correctly notes, the following does not adhere to the constraint of pardoning only those intrusions from QWERTY neighbors. DL distance, of course, has nothing to do with distance on a keyboard.  Oh, well. I'll leave up my response, which someone with more patience will easily better.

Code
d = DictionaryLookup[]; i = d[[RandomInteger@{1, Length@d}]];o = InputString["Type: " <> i];
Print["in: ", i, "\nout: ", o, "\n", Switch[i~DamerauLevenshteinDistance~o, 0, "perfect",
1, "ok", _, "wrong"]]

Explanation

d = DictionaryLookup[] stores a built-in dictionary of 92 k English words in d.
i = d[[RandomInteger@{1, Length@d}]] selects a random word and stores it in i.
o = InputString["Type: " <> i]; opens a dialog window (see figure) with the prompt "Type [i]."
i~DamerauLevenshteinDistance~o computes the Damerau-Levenshtein distance beween the requested word  and the word typed by the user. If the DL distance = 0, "perfect"; if the DL distance = 1, "ok"; otherwise, "wrong".

Test Results
For the first 7 tests, the input string, i, was manually set to "pinball".
The results were as desired with the exception of "pinbalgl", which was considered acceptable because it returns a DL distance value of 1.

in: pinball
  out: pinball
  perfect
in: pinball
  out: pingball
  ok
in: pinball
  out: pinbala
  ok
in: pinball
  out: pinbanll
  ok
in: pinball
  out: pinbannl
  wrong
in: pinball
  out: maxwell
  wrong
in: pinball
  out: pinbalgl
  ok
in: tureen
  out: turen
  ok
in: feeder
  out: feedr
  ok
in: tarmacs
  out: tarmax
  wrong

I like the interface :D Not sure if it answers the question exactly as stated though. Judging from the examples, (I think) it should accept an inserted character (and here's where the wording gets a bit unclear) if and only if one or both of the two characters it is adjacent to in the string is also adjacent to it on a keyboard (presumably qwerty). A test slightly stronger than the Levenshtein distance.

@primo. I see your point. I missed entirely the constraint about adjacent keys.  Clearly, that would require considerably more coding.

Even so, I would still consider this an acceptable solution, given the lack of participation. You already have my +1

Thanks. I thought the question looked lonely and abandoned being unanswered. So I gave it my best shot. To craft a fully suitable response, I'd need more time than I have.

Python 2, 634 581 568 565 bytes
import random
s="aszaqwsxdswedcfderfvgfrtgbhgtyhnjhyujmkjuikiopolkmnbvcx"
s+='z'+s[::-1]
d={}
for j in range(len(s)-1):d[s[j]]=d.get(s[j],"")+s[j+1]
v=random.choice(open("d","r").read().split())
u=list(raw_input(v+':'))
v=list(v)
e=sorted
i=n=r=b=0;l=len(v);g=1
q=any([v[:j]+e(v[j:j+4])+v[j+4:]==u[:j]+e(u[j:j+4])+u[j+4:]for j in range(l-3)])
while i<l*g:
 g*=i<len(u)
 if v[i]!=u[i]:
  if any([0<=i<l and u[i]in d[v[i+c]]for c in-1,0]):n+=1;g-=(b and u[i]!=b);b=u[i];del u[i]
  elif u[i]in v:r+=1;del u[i]
  else:g=0
 else:i+=1
print'good'if q+g*(n+2*r<3)else'bad'

It took a heck of lot of bytes to meet every single little special case and exception that this problem called for, and that's reflected in the size. There's probably some optimizations I'm missing, but I'm just happy that I met all the requirements.
To run it, put your list of lowercase words in a file called d in the same directory and just run.
It should be clear how this works once you know what each variable is:

s: a String of adjacent keys used to construct d
d: a Dictionary encoding a graph of key adjacencies, according to the keyboard i'm using right now. Lines 1 through 4 set this up.
v: the random word, first as a string, then as a list of characters
u: the User input, as a list of characters
e: the sortEd built-in
i: the Index into the correct word
n: the number of times an incorrect character that is Next to a correct character appears
r: the number of times an incorrect character that is in the word Repeats
g: whether the input is currently believed to be Good
l: the correct Length of the word
q: whether some shuffling of four adjacent letters in the user input would yield the correct word
j: a temp used in the creation of q

The important parts are:

the for at the top, which maps each letter in s to the next character. At the end, each lowercase letter is mapped to a string containing all letters adjacent on the keyboard (some with several repeats, but it doesn't matter).
the line where q is evaluated, which basically just sorts each set of four adjacent characters in both the input and correct word while leaving the rest of the lists alone. If sorting any such part results in both lists being the same, this is an allowed typo according to rule 3
the while loop, which iterates over both strings, looking for mismatches. Where one is found, it determines whether its of type 1 or type 2, preferring the former since we're allowed more type 1 errors than type 2 errors. The numbers of errors of type 1 and 2 are counted in n and r respectively. Errors which don't fall into either of these categories set g to 0 which breaks the loop. Notice the g-=(b and u[i]!=b);b=u[i]. This checks that this type 1 error involved the same character (saved in b) as last time (if there was a last time). This is because the first rule allows us to repeat the same character 1 or 2 times, but not two different characters.
the final line outputs good if and only if q OR (g AND (n<3 AND r==0) OR (r<2 AND n==0) ). Type 3 errors are mutually exclusive with the other types, but it is possible to have both type 1 and 2 in the same input. The condition is complex to allow one or the other but not both.

NB: this program will NOT accept "pinbala" as a correct spelling of "pinball", as it does not fall into any of the three described typo categories, as pointed out by ceased to turn counterclockwis