Write the shortest game of alak Alak was invented by the mathematician A. K.  Dewdney, and described in his 1984 book Planiverse. The rules of Alak are simple:
  
  Alak is a two-player game played on a one-dimensional board with eleven slots on it.  Each slot can hold at most one piece at a
  time.  There's two kinds of pieces, "x" and "o". x's belong to one player, o's to the other.
  The initial configuration of the board is:


      xxxx___oooo



  The players take turns moving.  At each turn, each player can move only one piece, once.  A player cannot pass up on his turn.  A player
  can move any one of his pieces to the next unoccupied slot to its right or left, which may involve jumping over occupied slots.  A
  player cannot move a piece off the side of the board.
  
  If a move creates a pattern where the opponent's pieces are surrounded, on both sides, by two pieces of the mover's color (with no
  intervening unoccupied blank slot), then those surrounded pieces are removed from the board.
  
  The goal of the game is to remove all of your opponent's pieces, at which point the game ends.  Removing all-but-one ends the game
  as well, since the opponent can't surround you with one piece, and so will always lose within a few moves anyway.


I found this game online and was wondering: can it be golfed? 

Rules of the golf


Your code must follow all the rules in the game, handling captures, proper moving, etc. (only exception is you don't have to add a bot, but you must have both players controlled somehow, and one player must be human).
Input must be move piece at tile X to tile Y, or quit. For example, you can use 1 4 to say 'move this piece at tile 1 to tile 4'. quit would end the program, although using Control-C would be acceptable. You also have to check if a move is invalid (by going outside the board or moving somewhere that you would have to cross over unoccupied spaces to get to or sending a message that is not a pair of tiles or quit).
Outputs for players winning and invalid must be P1 WINS, P2 WINS, and INVALID, respectively. (All of these are 7 characters.)
Output must show the board. That's all that's required.
It doesn't matter if you use any aids like numbered tiles or other pieces.
The challenge ends if:


One answer gets 50 votes
One answer remains the top-voted for 3 weeks, and no other answers were posted in that time



and the challenge has at least 3 answers (so there's some real competition).


Rules of the game


The player on the left must start first.
Only one piece occupies a square at a time. You move the piece left or right until it hits an unoccupied space. The board does not wrap, and you can't move through unoccupied areas. For example:

xoo__o. Here, the x moving right would change the board to _oox_o.
xxooo_. Here, the farthest-left x could move to yield _xooox, which captures the os, leaving _x___x.
x__oox. Here, the os are not captured (there is still a gap). Capture is not possible because you can't move through unoccupied spaces. The x on the left could only move one space, because there are no other pieces in between (leaving _x_oox).

Multiple adjacent pieces can be captured at once if the group is surrounded by the opponent's pieces. E.g. from x_oox to _xoox will capture both os and result in _x__x.
If after a move, you first capture the opponent's pieces, before checking if your own piece should be remove. Take two examples: 

o_oxx to oxox_. First, the second o is captured, ox_x_, so the first x remains on the board.
o_oox to oxoo_. This time, none of the os are captured, so the x is captured instead.
If you have only one piece, the game ends, because you can't capture with just one piece.



Let the games begin! I look forward to seeing what you come up with.
C, 617 592 bytes
#define O(x)(x-'x'?'x':'o')
q,f,t,k,i,x=4,o=4,*d;main(){char*A,Q[9],c='x',b[]=&quot;xxxx___oooo&quot;;printf(b);while(!q){scanf(&quot; %8[^\n]%*[^\n]&quot;,Q);if(!strcmp(Q,&quot;quit&quot;))break;f=*Q&gt;47&amp;&amp;*Q&lt;58?atoi(Q):-1;A=f&gt;9?Q+2:Q+1;t=*A==32&amp;&amp;A[1]&gt;47&amp;&amp;A[1]&lt;58?atoi(A+1):-1;i=t==f&amp;&amp;t&lt;0&amp;&amp;f&lt;0?1:0;for(k=f;k!=t;k+=(t-f)/abs(t-f))if(b[k]==95||b[t]-95||b[f]-c)i=1;if(i){printf(&quot;INVALID&quot;);continue;}b[t]=c;b[f]=95;for(t=0;t&lt;2;t++){d=c-'x'?&amp;o:&amp;x;for(k=1;k&lt;11;k++)if(b[k]==O(c)){for(i=k+1;b[i]==O(c)&amp;&amp;b[i];i++);if(b[i]==c&amp;&amp;b[k-1]==c)while(k&lt;i)b[k++]=95,(*d)--;}c=t?c:O(c);}printf(b);if(o&lt;2||x&lt;2)printf(&quot;P%d WINS&quot;,(x&gt;1)+1),q=1;}}

Unraveled:
#define O(x)(x-'x'?'x':'o')
q,f,t,k,i,x=4,o=4,*d;
main(){
    char*A,Q[9],c='x',b[]=&quot;xxxx___oooo&quot;;
    printf(b);
    while(!q){
        scanf(&quot; %8[^\n]%*[^\n]&quot;,Q);
        if(!strcmp(Q,&quot;quit&quot;))break;
        f=*Q&gt;47&amp;&amp;*Q&lt;58?atoi(Q):-1;
        A=f&gt;9?Q+2:Q+1;
        t=*A==32&amp;&amp;A[1]&gt;47&amp;&amp;A[1]&lt;58?atoi(A+1):-1;
        i=t==f&amp;&amp;t&lt;0&amp;&amp;f&lt;0?1:0;
        for(k=f;k!=t;k+=(t-f)/abs(t-f))
            if(b[k]==95||b[t]-95||b[f]-c)
                i=1;
        if(i){
            printf(&quot;INVALID&quot;);
            continue;
        }
        b[t]=c;
        b[f]=95;
        for(t=0;t&lt;2;t++){
            d=c-'x'?&amp;o:&amp;x;
            for(k=1;k&lt;11;k++)
                if(b[k]==O(c)){
                    for(i=k+1;b[i]==O(c)&amp;&amp;b[i];i++);
                    if(b[i]==c&amp;&amp;b[k-1]==c)
                        while(k&lt;i)b[k++]=95,(*d)--;
                }
            c=t?c:O(c);
        }
        printf(b);
        if(o&lt;2||x&lt;2)printf(&quot;P%d WINS&quot;,(x&gt;1)+1),q=1;
    }
}

I really wanted to get this one in ~400 bytes, but there are a lot of little rules here and the input processing ended up pretty obnoxious. I'm definitely not done with this. Here's a set of sample runs that covers just about everything:
xxxx___oooo0 4
_xxxx__oooo7 6
_xxxx_o_ooo4 5
_xxx_xo_ooo8 6
INVALID8 7
_xxx_xoo_oo3 4
_xx_xxoo_oo7 3
_xxo__o__oo1 4
__x_x_o__oo10 9
INVALID10 8
__x_x_o_oo_2 3
___xx_o_oo_6 5
___xxo__oo_6 6
INVALID5 5
INVALID3 6
____x_x_oo_8 7
____x_xo_o_6 8
____x__o_o_P2 WINS
 
xxxx___oooo0 4
_xxxx__oooo10 6
_xxxx_oooo_1 5
__xxxxoooo_9 1
_o____ooo__P2 WINS
 
xxxx___oooo0 4
_xxxx__oooo7 6
_xxxx_o_ooo1 5
__xxxxo_ooo10 7
__xxxxoooo_2 10
___xxx____xP1 WINS
 
xxxx___oooo3 4
xxx_x__ooooquits
INVALIDtestme
INVALID3*4
INVALID3 four
INVALIDthree four
INVALIDthisstringislongerthanmybuffer
INVALID10 0
INVALID4 5
INVALID7 6
xxx_x_o_oooquit

If I've misinterpreted something, please let me know!