Пример #1
0
 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;
 }