cleanup
This commit is contained in:
parent
e223a75c0e
commit
e9e763332f
4 changed files with 14 additions and 20 deletions
|
@ -145,8 +145,7 @@ impl Machine {
|
|||
}
|
||||
}
|
||||
PTile::IO => {
|
||||
if front_tile == &Tile::default()
|
||||
&& self.input_index < self.input.len()
|
||||
if front_tile == &Tile::BLANK && self.input_index < self.input.len()
|
||||
{
|
||||
let value = self.input[self.input_index] as MarbleValue;
|
||||
self.input_index += 1;
|
||||
|
@ -154,7 +153,7 @@ impl Machine {
|
|||
}
|
||||
}
|
||||
PTile::Bag => {
|
||||
if front_tile == &Tile::default() {
|
||||
if front_tile == &Tile::BLANK {
|
||||
new_marbles.push((front_pos, 0, dir));
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +337,7 @@ impl Machine {
|
|||
OpenTile::Blank => value,
|
||||
OpenTile::Digit(n) => value.wrapping_mul(10).wrapping_add(n as MarbleValue),
|
||||
};
|
||||
board.set(*pos, Tile::default());
|
||||
board.set(*pos, Tile::BLANK);
|
||||
board.set(target_pos, Tile::Marble { value, dir });
|
||||
*pos = target_pos;
|
||||
};
|
||||
|
@ -405,7 +404,7 @@ impl Machine {
|
|||
|
||||
// remove marbles
|
||||
for &i in removed_marbles.iter().rev() {
|
||||
self.board.set(self.marbles[i], Tile::default());
|
||||
self.board.set(self.marbles[i], Tile::BLANK);
|
||||
self.marbles.swap_remove(i);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue