Skip to content

Commit

Permalink
add pervert command
Browse files Browse the repository at this point in the history
  • Loading branch information
geremachek committed Jan 23, 2022
1 parent 87c05e6 commit eecd090
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub enum Command {
Atoms,
Pen,
Orbit,
Pervert,
Decay,
Destroy,
Tether,
Expand Down Expand Up @@ -87,6 +88,7 @@ impl FromStr for Command {
"atoms" => Ok(Command::Atoms),
"pen" => Ok(Command::Pen),
"orbit" => Ok(Command::Orbit),
"pervert" => Ok(Command::Pervert),
"decay" => Ok(Command::Decay),
"destroy" => Ok(Command::Destroy),
"tether" => Ok(Command::Tether),
Expand Down Expand Up @@ -134,7 +136,7 @@ impl Command {

let needed = match self {
Command::Nomen => all_with_min(1), // min of 1
Command::Spot | Command::Span | Command::Molecule | Command::Pen | Command::Orbit | Command::Decay | Command::Destroy |
Command::Spot | Command::Span | Command::Molecule | Command::Pen | Command::Orbit | Command::Pervert | Command::Decay | Command::Destroy |
Command::Atom | Command::Scribe | Command::Adieu | Command::Carve | Command::Pin | Command::Columns | Command::Burn | Command::Volume |
Command::Volumes | Command::Carved | Command::Atoms | Command::Tether | Command::Stitch | Command::Fray => 0,
Command::Focus | Command::Traverse | Command::Appear | Command::Shave | Command::Shelve | Command::Inscribe | Command::Trample | Command::Incant |
Expand Down
1 change: 1 addition & 0 deletions src/plane/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl Plane {
Command::Molecule => self.stack.molecule(),
Command::Pen => self.stack.pen(),
Command::Orbit => self.stack.orbit()?,
Command::Pervert => self.stack.pervert(),
Command::Decay => self.stack.decay(),
Command::Destroy => self.stack.destroy(),
Command::Tether => self.stack.tether()?,
Expand Down
6 changes: 6 additions & 0 deletions src/plane/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ impl Stack {
Ok(())
}

// "pervert" (reverse) the stack

pub fn pervert(&mut self) {
self.stack.reverse()
}

// remove the last item from the stack

pub fn decay(&mut self) {
Expand Down

0 comments on commit eecd090

Please sign in to comment.