text: #pragma once
  #include <vector>
  #include <set>
  
  #include "Board.h"
  
  
  // basic search like BFS, or DFS
  // but uses a filter to select the adjacent nodes in the board.
  // the filter allows us to search in straight lines for tic-tac-toe style
  // or more limited styles, like just diagonals, or just straight lines.
  class Search
  {
  public:
    static constexpr int kInvalidValue = -1;
    struct Neighbor
    {
      int x{ 0 };
      int y{ 0 };
      int z{ 0 };
    };
  
    Search() = default;
    ~Search() = default;
    inline void setFilter(const std::vector<Board::Position>& filter) { filter_ = filter; }
    bool findPath(Board& b, Board::Position& p, int searchValue);
    inline std::set<int>& visited() { return visited_; }
  
  private:
    void defaultFilter();
    std::vector<int> adjacent(Board& b, int currentIdx, int searchValue);
    std::vector<Board::Position> filter_; // list of delta positions to select neighbors.
    std::set<int> visited_;
    std::vector<int> stack_;
  };
  