Skip to content

Commit

Permalink
Ceil cutoff and average qualifiers.
Browse files Browse the repository at this point in the history
  • Loading branch information
FiveMovesAhead committed Jun 18, 2024
1 parent 9b9d8c8 commit 0f70b0b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tig-protocol/src/add_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,9 @@ async fn update_cutoffs<T: Context>(ctx: &mut T, block: &Block) {
.unwrap_or_else(|e| panic!("get_player_by_id error: {:?}", e));
let mut data = player.block_data().clone();

data.cutoff =
Some((total_solutions / num_challenges * config.qualifiers.cutoff_multiplier) as u32);
data.cutoff = Some(
(total_solutions / num_challenges * config.qualifiers.cutoff_multiplier).ceil() as u32,
);

ctx.update_player_block_data(player_id, &block.id, &data)
.await
Expand All @@ -448,12 +449,13 @@ async fn update_solution_signature_thresholds<T: Context>(ctx: &mut T, block: &B
let player = get_player_by_id(ctx, player_id, Some(&block.id))
.await
.unwrap_or_else(|e| panic!("get_player_by_id error: {:?}", e));
let player_avg_qualifiers = player
let player_avg_qualifiers = (player
.block_data()
.num_qualifiers_by_challenge()
.values()
.fold(0, |acc, v| acc + *v) as f64
/ num_challenges;
/ num_challenges)
.ceil();
solutions_rate_multiplier_by_player.insert(
player.id.clone(),
player
Expand Down

0 comments on commit 0f70b0b

Please sign in to comment.