//假定本方持黑,对方下子后,判断某黑棋是否被吃掉

#include <iostream>
#include <algorithm>
enum {
  N = 19
};
enum {
  Black,
  White,
  Blank,
  Visited,
};
void foo(int a[][N], int i, int j, bool & r)
{
  std::cout << "-" << i << "," <<j<< "-\n";
  a[i][j] = Visited;
  if ((i-1>=0 && a[i-1][j] == Blank)
    ||(j-1>=0 && a[i][j-1] == Blank)
    ||(j+1<N && a[i][j+1] == Blank)
    ||(i+1<N && a[i+1][j] == Blank)
    )
  {
    r = true;
    return;
  }
  if (i-1 >= 0)
  {
    if (a[i-1][j] == Black)
    {
      foo(a, i - 1, j, r);
    }
  }
 
  if (j-1 >= 0)
  {
    if (a[i][j-1] == Black)
    {
      foo(a, i, j -1, r);
    }
  }
 
  if (i+1 < N)
  {
    if (a[i+1][j] == Black)
    {
      foo(a, i + 1, j, r);
    }
  }
 
  if (j+1 < N)
  {
    if (a[i][j+1] == Black)
    {
      foo(a, i, j +1, r);
    }
  }
}
 
int main()
{
  bool r = false;
  int a[N][N];
  std::fill(&a[0][0], &a[1][0], Black);
 
  std::fill(&a[1][0], &a[N][0], White);
  for (int i = 0 ; i<N; ++i)
  {
    a[i][0] = Black;
  }
  for (int i = 0 ; i<N; ++i)
  {
    a[i][9] = Black;
  }
  a[8][8] = Blank;
  foo(a,0, 5, r);
  std::cout << r << std::endl;
}