Updated Ruleset documentation
parent
28f5d3ea1f
commit
91677ca708
|
|
@ -118,9 +118,18 @@ pub trait GraphLike<Node, NodeId> {
|
|||
}
|
||||
|
||||
pub trait Ruleset<Node, NodeId> {
|
||||
/// 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<Node, NodeId>, id: NodeId) -> Option<f32>
|
||||
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<Node, NodeId>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue