sim: use usize instead of i16 for garbage level min/max
This commit is contained in:
parent
68cb2cae58
commit
e64b11cefe
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue