#pragma once
#include "point.hpp"
#include "matrix.hpp"

class Pathing {
public:
  size_t $width;
  size_t $height;
  Matrix $paths;
  Matrix $input;

  Pathing(size_t width, size_t height) :
    $width(width),
    $height(height),
    $paths(height, MatrixRow(width, 1)),
    $input(height, MatrixRow(width, 1))
  {}

  void compute_paths(Matrix &walls);
  void set_target(const Point &at, int value=0);
  void clear_target(const Point &at);
  Matrix &paths() { return $paths; }
  Matrix &input() { return $input; }
  int distance(Point to) { return $paths[to.y][to.x];}

  bool INVARIANT();
};