diff --git a/src/lib.rs b/src/lib.rs index 5b69801..9e77169 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -118,9 +118,18 @@ pub trait GraphLike { } pub trait Ruleset { + /// Calculate the "entropy" of a node, based on the current state of the graph. Should return + /// None if the node is impossible, and Some(entropy) if it is possible. The exact meaning of + /// entropy is up to the implementation, but it should be a value that can be compared between + /// nodes to determine which one is more "constrained". For example, it could be the number of + /// possible values that the node can take, or the number of empty neighbours it has. + /// + /// By default the WFC algorithm chooses the node with the lowest entropy to "collapse" fn entropy(&self, graph: &impl GraphLike, id: NodeId) -> Option where NodeId: Copy; + /// Choose a node to "collapse" to, based on the current state of the graph. Should return None + /// if the node is impossible. fn choose( &self, graph: &impl GraphLike,