fn recurse(
    matches: &[IplLeagueMatch],
    index: usize,
    points_table: &mut IplScoreBoard,
    all_pos_bucket: &mut [HashSet<[u8; 8]>; 10],
) {
    // true means `a` wins, false means `a` loses
    unsafe {
        total_iterations += 1;
    }

    if index % 10 == 0 {
        if all_pos_bucket[index / 10].insert(points_table.scores) == false {
            return; // no need to recurse further; this path already tried
        }
    }

    if index == matches.len() {
        // league matches complete (`after` the last match)
        ipl::update_points_table(points_table);
        return;
    }

    match matches[index].winner {
        Some(winner) => {
            points_table.team_won(winner);
            recurse(matches, index + 1, points_table, all_pos_bucket);
        }
        None => {
            points_table.team_won(matches[index].team1);
            recurse(matches, index + 1, points_table, all_pos_bucket);

            points_table.team_lost(matches[index].team1);
            points_table.team_won(matches[index].team2);
            recurse(matches, index + 1, points_table, all_pos_bucket);
            points_table.team_lost(matches[index].team2);
        }
    };
}
// say a team won 14 of it, is the maximum possible wins, initialising with maximum
say a team won 14 of it, is the maximum possible wins, initialising with maximum
say a team won 14 of it is the maximum possible wins initialising with maximum
fn recurse(
    matches: &[IplLeagueMatch],
    index: usize,
    points_table: &mut IplScoreBoard,
    all_pos_bucket: &mut [HashSet<[u8; 8]>; 10],
) {
    // true means `a` wins, false means `a` loses
    unsafe {
        total_iterations += 1;
    }
    if index % 10 == 0 {
        if all_pos_bucket[index / 10].insert(points_table.scores) == false {
            return; // no need to recurse further; this path already tried
        }
    }
    if index == matches.len() {
        // league matches complete (`after` the last match)
        ipl::update_points_table(points_table);
        return;
    }
    match matches[index].winner {
        Some(winner) => {
            points_table.team_won(winner);
            recurse(matches, index + 1, points_table, all_pos_bucket);
        }
        None => {
            points_table.team_won(matches[index].team1);
            recurse(matches, index + 1, points_table, all_pos_bucket);
            points_table.team_lost(matches[index].team1);
            points_table.team_won(matches[index].team2);
            recurse(matches, index + 1, points_table, all_pos_bucket);
            points_table.team_lost(matches[index].team2);
        }
    };
}
fn recurse ( matches : & [ IplLeagueMatch ] , index : usize , points_table : & mut IplScoreBoard , all_pos_bucket : & mut [ HashSet < [ u8 ; 8 ] > ; 10 ] , ) { // true means `a` wins, false means `a` loses unsafe { total_iterations += 1 ; } if index % 10 == 0 { if all_pos_bucket [ index / 10 ] . insert ( points_table . scores ) == false { return ; // no need to recurse further; this path already tried } } if index == matches . len ( ) { // league matches complete (`after` the last match) ipl :: update_points_table ( points_table ) ; return ; } match matches [ index ] . winner { Some ( winner ) => { points_table . team_won ( winner ) ; recurse ( matches , index + 1 , points_table , all_pos_bucket ) ; } None => { points_table . team_won ( matches [ index ] . team1 ) ; recurse ( matches , index + 1 , points_table , all_pos_bucket ) ; points_table . team_lost ( matches [ index ] . team1 ) ; points_table . team_won ( matches [ index ] . team2 ) ; recurse ( matches , index + 1 , points_table , all_pos_bucket ) ; points_table . team_lost ( matches [ index ] . team2 ) ; } } ; }
say a team won 14 of it, is the maximum possible wins, initialising with maximum
say a team won 14 of it is the maximum possible wins initialising with maximum
matches
&[IplLeagueMatch]
index
usize
points_table
&mut IplScoreBoard
all_pos_bucket
&mut [HashSet<[u8; 8]>; 10]
matches
&[IplLeagueMatch]
index
usize
points_table
&mut IplScoreBoard
all_pos_bucket
&mut [HashSet<[u8; 8]>; 10]