def moved_matrix_with_parent( i, j, new_i, new_j, open_list, closed_list )
      return nil if !index_exist?( new_i, new_j )      

      swapped_matrix = swap( i, j, new_i, new_j )    

      new_depth = @depth + 1
      swapped_matrix = GameMatrix.new( swapped_matrix, self, new_depth )            
      return nil if closed_list.include?( swapped_matrix )
      swapped_matrix.calculate_cost    

      open_list_matrix = open_list.find{ |e| e == swapped_matrix }      
      if open_list_matrix && open_list_matrix.cost < swapped_matrix.cost
        return open_list_matrix
      elsif open_list_matrix
        open_list_matrix.parent = self
        open_list_matrix.depth = new_depth
        return open_list_matrix        
      else
        return swapped_matrix
      end
    end
def moved_matrix_with_parent( i, j, new_i, new_j, open_list, closed_list )
      return nil if !index_exist?( new_i, new_j )      

      swapped_matrix = swap( i, j, new_i, new_j )    

      new_depth = @depth + 1
      swapped_matrix = GameMatrix.new( swapped_matrix, self, new_depth )            
      return nil if closed_list.include?( swapped_matrix )
      swapped_matrix.calculate_cost    

      open_list_matrix = open_list.find{ |e| e == swapped_matrix }      
      if open_list_matrix && open_list_matrix.cost < swapped_matrix.cost
        return open_list_matrix
      elsif open_list_matrix
        open_list_matrix.parent = self
        open_list_matrix.depth = new_depth
        return open_list_matrix        
      else
        return swapped_matrix
      end
    end
Get swapped matrix, check him in closed and open list