Skip to content

Commit

Permalink
feat: board support reset level
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian committed Jan 16, 2024
1 parent ef82737 commit 3946ade
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ impl Board {
return true;
}

pub fn reset(&mut self) {
while !self.movements.is_empty() {
self.undo_move();
}
}

pub fn undo_push(&mut self) {
while let Some(history) = self.movements.last() {
if history.is_push {
Expand Down

0 comments on commit 3946ade

Please sign in to comment.