labirust 0.3.0

Naive rust crate for implementing and testing maze solving Algorithms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! ## Algorithm
//!
//! This module contains the definition of the [`Algorithm`] trait, implemented by [`Maze`] resolution strategies.
//! Already existing implementations of that trait can be found in the [`crate::implementations`] module.
//!

use crate::{Context, Guess, Insight};

/// Trait encapsulating the behavior of an algorithm solving mazes.
/// Implementing this trait is done by providing a `progress` method which gets called iteratively on each steps of a [`Maze`] resolution.
pub trait Algorithm {
    /// will be called on each step of the traversal of the [`Maze`].
    /// `insight` is a view on the position discovered on the previous movement.
    /// `ctx` is a view on the [`Maze`], useful for accessing properties of the maze.
    fn progress(&mut self, insight: &Insight, ctx: &mut Context) -> Guess;
}