Class DFSHelper

java.lang.Object
it.polimi.ingsw.model.DFSHelper

public class DFSHelper extends Object
helper class for the Depth First Search algorithm. Immutable
  • Constructor Details

    • DFSHelper

      public DFSHelper()
  • Method Details

    • resetVisitedMatrix

      public static void resetVisitedMatrix(int[][] mat)
      reset the matrix of the nodes visited in the DFS
      Parameters:
      mat - the matrix
    • isIndexValid

      public static boolean isIndexValid(int x, int y)
      check if the index is in the matrix
      Parameters:
      x - position x
      y - posizione y
      Returns:
      true iff the index is in the matrix
    • isVisited

      public static boolean isVisited(int x, int y, int[][] mat)
      check if the node was already visited, otherwise visit the node
      Parameters:
      x - position x
      y - position y
      mat - matrix of visited nodes
      Returns:
      true iff the node was visited