samples/13_path_finding_algorithms/02_detailed_breadth_first_search/app/main.rb
def adjacent_neighbors cell
    neighbors = [] 

    neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 
    neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 
    neighbors << [cell.x, cell.y - 1] unless cell.y == 0 
    neighbors << [cell.x - 1, cell.y] unless cell.x == 0 

    neighbors 
  end
# Returns a list of adjacent cells
# Used to determine what the next cells to be added to the frontier are
Returns a list of adjacent cells
Used to determine what the next cells to be added to the frontier are
Returns a list of adjacent cells Used to determine what the next cells to be added to the frontier are
def adjacent_neighbors cell
    neighbors = [] 
    neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1 
    neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1 
    neighbors << [cell.x, cell.y - 1] unless cell.y == 0 
    neighbors << [cell.x - 1, cell.y] unless cell.x == 0 
    neighbors 
  end
def adjacent_neighbors cell neighbors = [ ] neighbors << [ cell . x , cell . y + 1 ] unless cell . y == grid . height - 1 neighbors << [ cell . x + 1 , cell . y ] unless cell . x == grid . width - 1 neighbors << [ cell . x , cell . y - 1 ] unless cell . y == 0 neighbors << [ cell . x - 1 , cell . y ] unless cell . x == 0 neighbors end
Returns a list of adjacent cells
Used to determine what the next cells to be added to the frontier are
Returns a list of adjacent cells Used to determine what the next cells to be added to the frontier are
cell