fn solve_clue(clue: u8, bd: u8, cf: u8, n: u8) -> usize {
    // patterns 2, 3, 5
    // changing segments are b,c,e,f
    // with the previous clue of digit 1 we know if the clue contain both segments cf or only one of them
    let count_cf = (clue & cf).count_ones();
    // with the previous clues of digit 1 and 4 we know if the clue contain both segments db or only one of them
    let count_bd = (clue & bd).count_ones();
    match (n, count_bd, count_cf) {
        (2, _, _) => 1,
        (3, _, _) => 7,
        (4, _, _) => 4,
        (5, 1, 1) => 2,
        (5, 1, 2) => 3,
        (5, 2, 1) => 5,
        (6, 2, 2) => 9,
        (6, 1, 2) => 0,
        (6, 2, 1) => 6,
        (7, _, _) => 8,
        _ => panic!("{} {} {}", n, count_bd, count_cf),
    }
}
/// Analyses a pattern with multiple possibilities
Analyses a pattern with multiple possibilities
Analyses a pattern with multiple possibilities
fn solve_clue(clue: u8, bd: u8, cf: u8, n: u8) -> usize {
    // patterns 2, 3, 5
    // changing segments are b,c,e,f
    // with the previous clue of digit 1 we know if the clue contain both segments cf or only one of them
    let count_cf = (clue & cf).count_ones();
    // with the previous clues of digit 1 and 4 we know if the clue contain both segments db or only one of them
    let count_bd = (clue & bd).count_ones();
    match (n, count_bd, count_cf) {
        (2, _, _) => 1,
        (3, _, _) => 7,
        (4, _, _) => 4,
        (5, 1, 1) => 2,
        (5, 1, 2) => 3,
        (5, 2, 1) => 5,
        (6, 2, 2) => 9,
        (6, 1, 2) => 0,
        (6, 2, 1) => 6,
        (7, _, _) => 8,
        _ => panic!("{} {} {}", n, count_bd, count_cf),
    }
}
fn solve_clue ( clue : u8 , bd : u8 , cf : u8 , n : u8 ) -> usize { // patterns 2, 3, 5 // changing segments are b,c,e,f // with the previous clue of digit 1 we know if the clue contain both segments cf or only one of them let count_cf = ( clue & cf ) . count_ones ( ) ; // with the previous clues of digit 1 and 4 we know if the clue contain both segments db or only one of them let count_bd = ( clue & bd ) . count_ones ( ) ; match ( n , count_bd , count_cf ) { ( 2 , _ , _ ) => 1 , ( 3 , _ , _ ) => 7 , ( 4 , _ , _ ) => 4 , ( 5 , 1 , 1 ) => 2 , ( 5 , 1 , 2 ) => 3 , ( 5 , 2 , 1 ) => 5 , ( 6 , 2 , 2 ) => 9 , ( 6 , 1 , 2 ) => 0 , ( 6 , 2 , 1 ) => 6 , ( 7 , _ , _ ) => 8 , _ => panic ! ( " " n count_bd count_cf ) , } }
Analyses a pattern with multiple possibilities
Analyses a pattern with multiple possibilities
clue
u8
bd
u8
cf
u8
n
u8