/ explode
/ http://www.math.chalmers.se/~magnus/GuiFest-95/challenges.html
/ http://www.cs.chalmers.se/~magnus/GuiFest-95/fudgets/solutions.html
/ http://www.wadham.ox.ac.uk/~ohazell/Atoms/
/ message processing:
."\\r ",$_t / set random seed to time
offer:{ / offer a game
S::-1 1()_draw 2 / my sign
N:::[#x;0$_i;6 6] / board dimensions
B::(*/N)#0 / board, flattened
A::arcs N 0 / square-to-square arcs
P::()_draw 2 / play (1) or wait (0)
}
arcs:{[n] / compute arcs
m:(-1 0;0 -1;1 0;0 1)+\:/:/:(!n),/:\:!n / matrix of neighbors
,/{n _sv+x@&((x[;0]>-1)&x[;0]-1)&x[;1] {rows cols} "
"to accept a game: k explode "
""
"you may move when your board says 'go' "
""
"background colors: "
""
" yellow: you may place a stone here "
" gray: you may not place a stone here "
" green: owned by green "
" red: owned by red "
""
"the game is over when the board is all red or all green")
if[~_p;`show$`Z] / show board if no port