Skip to content

Commit

Permalink
chore: rename hole to crater
Browse files Browse the repository at this point in the history
this simply makes the code more consistent
  • Loading branch information
b1rger committed Aug 22, 2023
1 parent 7367305 commit 275f8e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ fn main() -> io::Result<()> {
.world
.craters
.iter()
.any(|hole| hole.col == ctx.world.rover.col)
.any(|crater| crater.col == ctx.world.rover.col)
{
ctx.world.rover.points += 4;
}
if ctx
.world
.craters
.iter()
.any(|hole| ctx.world.rover.range().contains(&hole.col))
.any(|crater| ctx.world.rover.range().contains(&crater.col))
&& !ctx.world.rover.jumping()
{
ctx.world.rover.crash();
Expand Down
6 changes: 3 additions & 3 deletions src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ impl World {
.retain(|bullet| !bulletremovals.contains(&bullet.col));

if self.rover.moving() {
self.craters.iter_mut().for_each(|hole| hole.col -= 1);
self.craters.retain(|hole| hole.col > 0);
self.craters.iter_mut().for_each(|crater| crater.col -= 1);
self.craters.retain(|crater| crater.col > 0);
self.monsters
.iter_mut()
.for_each(|monster| monster.col -= 1);
Expand All @@ -74,7 +74,7 @@ impl World {
.monsters
.iter()
.all(|monster| !range.contains(&monster.col))
&& self.craters.iter().all(|hole| !range.contains(&hole.col))
&& self.craters.iter().all(|crater| !range.contains(&crater.col))
&& rng.gen_bool(0.5)
{
if rng.gen_bool(level.prob_crater_one) {
Expand Down

0 comments on commit 275f8e9

Please sign in to comment.