You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
728 B
31 lines
728 B
#pragma once
|
|
#include "point.hpp"
|
|
#include "matrix.hpp"
|
|
#include <functional>
|
|
|
|
using matrix::Matrix;
|
|
|
|
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, matrix::Row(width, 1)),
|
|
$input(height, matrix::Row(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];}
|
|
void random_flood(const Point from, std::function<void(Point at, int dnum)> cb);
|
|
|
|
bool INVARIANT();
|
|
};
|
|
|