chore: change weights for new square generation

This commit is contained in:
YK 2024-07-14 20:29:27 +03:00
parent 7f3e444667
commit 4881dcb15c

View File

@ -272,7 +272,7 @@ fn spawn_new_square (mut field: ResMut<Field>) {
let rng = &mut thread_rng();
let Some(empty) = field.0.iter().enumerate().filter(|&(_, &val)| val == 0).map(|(idx, _)| idx).choose(rng) else { return };
let choices = [1, 2, 3];
let weights = [8, 4, 1];
let weights = [8, 3, 1];
let Ok(index) = WeightedIndex::new(&weights) else { return };
field.0[empty] = choices[index.sample(rng)];
}