예제 #1
0
파일: task2.cpp 프로젝트: xotonic/alg-rgr
 void visit(int u, int treeIndex = 0)
 {
     stack.push_back(u);
     data[u].color = gray;
     QVector<int> adjacent = get_adjacent(u);
     
     foreach (auto v, adjacent)
     {
         if (data[v].color == white )
             visit(v);
         
         if (data[v].color == gray && v == target)
         {
             //if (stack.size() > 2) {
                 foreach (int s , stack)
                 {
                     out << " " << s;
                     //data[s].color = white;
                 }
                 out << " " << stack.first() << endl;
                 
             //}
         }
     }
예제 #2
0
 /**
  * is_adjacent - Returns true if square is adjacent to a square with a piece on it
  */
 bool is_adjacent(unsigned row, unsigned col) const
 {
   return get_adjacent(row, col, true).size() > 0;
 }