pub fn update_points_table(points_table: &mut IplScoreBoard) {
    points_table.total_possibilities += 1;

    let mut original_scores: [(u8, usize); 4] = [(0u8, 0); 4]; // original top 4 scores and indices

    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[0] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;

    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[1] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;

    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[2] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;

    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[3] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;

    // we got the 4th lowest score from top
    let lowest_qualifying_score = current_maximum;
    unsafe {
        minimum_wins_qualification = minimum_wins_qualification.min(lowest_qualifying_score);
    }

    // restore original values
    for i in &original_scores {
        let org = *i;
        points_table.scores[org.1] = org.0;
    }

    // chose which teams qualified
    for i in 0..8 {
        if points_table.scores[i as usize] >= lowest_qualifying_score {
            points_table.total_qualifications[i as usize] += 1;
        }
    }
}
// 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
pub fn update_points_table(points_table: &mut IplScoreBoard) {
    points_table.total_possibilities += 1;
    let mut original_scores: [(u8, usize); 4] = [(0u8, 0); 4]; // original top 4 scores and indices
    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[0] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;
    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[1] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;
    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[2] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;
    let (current_maximum, max_index) = max_element(&points_table.scores);
    original_scores[3] = (current_maximum, max_index);
    points_table.scores[max_index] = 0;
    // we got the 4th lowest score from top
    let lowest_qualifying_score = current_maximum;
    unsafe {
        minimum_wins_qualification = minimum_wins_qualification.min(lowest_qualifying_score);
    }
    // restore original values
    for i in &original_scores {
        let org = *i;
        points_table.scores[org.1] = org.0;
    }
    // chose which teams qualified
    for i in 0..8 {
        if points_table.scores[i as usize] >= lowest_qualifying_score {
            points_table.total_qualifications[i as usize] += 1;
        }
    }
}
pub fn update_points_table ( points_table : & mut IplScoreBoard ) { points_table . total_possibilities += 1 ; let mut original_scores : [ ( u8 , usize ) ; 4 ] = [ ( 0u8 , 0 ) ; 4 ] ; // original top 4 scores and indices let ( current_maximum , max_index ) = max_element ( & points_table . scores ) ; original_scores [ 0 ] = ( current_maximum , max_index ) ; points_table . scores [ max_index ] = 0 ; let ( current_maximum , max_index ) = max_element ( & points_table . scores ) ; original_scores [ 1 ] = ( current_maximum , max_index ) ; points_table . scores [ max_index ] = 0 ; let ( current_maximum , max_index ) = max_element ( & points_table . scores ) ; original_scores [ 2 ] = ( current_maximum , max_index ) ; points_table . scores [ max_index ] = 0 ; let ( current_maximum , max_index ) = max_element ( & points_table . scores ) ; original_scores [ 3 ] = ( current_maximum , max_index ) ; points_table . scores [ max_index ] = 0 ; // we got the 4th lowest score from top let lowest_qualifying_score = current_maximum ; unsafe { minimum_wins_qualification = minimum_wins_qualification . min ( lowest_qualifying_score ) ; } // restore original values for i in & original_scores { let org = * i ; points_table . scores [ org . 1 ] = org . 0 ; } // chose which teams qualified for i in 0 .. 8 { if points_table . scores [ i as usize ] >= lowest_qualifying_score { points_table . total_qualifications [ i as usize ] += 1 ; } } }
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
points_table
&mut IplScoreBoard
points_table
&mut IplScoreBoard