Guest User

Untitled

a guest
Apr 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. private bool GetNext(DIRECTION direction, TransportCell currentCell ) {
  2.             bool Done = false;
  3.             if (direction == DIRECTION.ROW) {
  4.                 for (int j = 0; j < consumerCount; j++) {
  5.                     if (j == currentCell.Col) { continue; }
  6.                     else if (j == start.Col && currentCell.Row == start.Row) { return true; }
  7.                     else if (!TaskMatrix[currentCell.Row, j].Cargo.IsNull) {
  8.                         Done = GetNext(DIRECTION.COLUMN, TaskMatrix[currentCell.Row, j]);
  9.                         if (Done) { Cycle.Add(this.TaskMatrix[currentCell.Row, j]); return true; }
  10.                     }
  11.                 }
  12.             }
  13.  
  14.  
  15.             else {
  16.                 for (int i = 0; i < providerCount; i++) {
  17.                     if (i == currentCell.Row) { continue; }
  18.                     else if (i == start.Row && currentCell.Col == start.Col) { return true; }
  19.                     else if (!TaskMatrix[i, currentCell.Col].Cargo.IsNull) {
  20.                        
  21.                            Done = GetNext(DIRECTION.ROW, TaskMatrix[i, currentCell.Col]);
  22.                            if (Done) {
  23.                                Cycle.Add(this.TaskMatrix[i, currentCell.Col]);
  24.                                return true;
  25.                            }
  26.                     }
  27.                 }
  28.  
  29.             }
  30.             return false;
  31.         }
Add Comment
Please, Sign In to add comment