Beispiel #1
0
 private void ProcessAdjacentNode(int row, int column, Queue <Tuple <int, int> > queue, int newDistance, Tuple <int, int> pos, Octocat cat, List <Tuple <int, int> > nextPos)
 {
     if (row >= 0 &&
         column >= 0 &&
         row < BoardSize &&
         column < BoardSize &&
         !Board[row, column] &&
         !visited[row, column] &&
         Cats.Count(cc => cc.RowIndex == row && cc.ColumnIndex == column) == 0)
     {
         var p = new Tuple <int, int>(row, column);
         queue.Enqueue(p);
         visited[row, column]  = true;
         distance[row, column] = newDistance;
         prev[row, column]     = pos;
         if (pos.Item1 == cat.RowIndex && pos.Item2 == cat.ColumnIndex)
         {
             nextPos.Add(p);
         }
     }
 }