domino-lib 2.0.0

Domino library, create sequences and puzzles, solve and validate them in rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use rand::seq::SliceRandom;

use crate::{Graph, Node};

pub(super) fn first_node<'a>(graph: &'a Graph) -> impl Fn(bool) -> Node + 'a {
    move |random: bool| {
        let mut seed = rand::thread_rng();
        if random {
            graph.nodes.choose(&mut seed).unwrap().clone()
        } else {
            graph.nodes.first().unwrap().clone()
        }
    }
}