sim: use usize instead of i16 for garbage level min/max

This commit is contained in:
tali 2023-04-11 20:42:31 -04:00
parent 68cb2cae58
commit e64b11cefe
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ pub struct Garbage<R: Rng> {
// current level of garbage on the matrix
level: i16,
// min/max garbage to insert on the matrix
range: RangeInclusive<i16>,
range: RangeInclusive<usize>,
}
impl<R: Rng> Garbage<R> {
@ -17,7 +17,7 @@ impl<R: Rng> Garbage<R> {
/// - `rng`: random number source
/// - `count`: total number of garbage rows to insert
/// - `range`: min/max amount of garbage on the matrix at a given time
pub fn new(rng: R, count: usize, range: RangeInclusive<i16>) -> Self {
pub fn new(rng: R, count: usize, range: RangeInclusive<usize>) -> Self {
Self {
cheese: Cheese::new(rng).take(count),
level: 0,
@ -47,7 +47,7 @@ impl<R: Rng> Garbage<R> {
} else {
*self.range.end()
};
let difference = (target as usize).saturating_sub(self.level as usize);
let difference = target.saturating_sub(self.level as usize);
(&mut self.cheese)
.take(difference)

View File

@ -10,7 +10,7 @@ pub struct Options {
/// Total number of garbage lines required to clear.
pub goal: usize,
/// Min/max number of garbage lines on the matrix at a given time.
pub garbage: RangeInclusive<i16>,
pub garbage: RangeInclusive<usize>,
/// Number of preview pieces.
pub previews: usize,
}