author | unC0Rr |
Fri, 22 Nov 2024 17:29:30 +0100 | |
branch | transitional_engine |
changeset 16040 | 6c5b3c576fc6 |
permissions | -rw-r--r-- |
16040 | 1 |
#[derive(Clone)] |
2 |
pub enum Direction { |
|
3 |
Left, |
|
4 |
Right |
|
5 |
} |
|
6 |
#[derive(Clone)] |
|
7 |
pub enum Action { |
|
8 |
Walk(Direction), |
|
9 |
LongJump, |
|
10 |
HighJump(usize) |
|
11 |
} |
|
12 |
||
13 |
pub struct Actions { |
|
14 |
actions: Vec<Action> |
|
15 |
} |
|
16 |
||
17 |
impl Actions { |
|
18 |
pub fn new() -> Self { |
|
19 |
Self { |
|
20 |
actions: vec![], |
|
21 |
} |
|
22 |
} |
|
23 |
||
24 |
pub fn push(&mut self, action: Action) { |
|
25 |
self.actions.push(action) |
|
26 |
} |
|
27 |
||
28 |
pub fn pop(&mut self) -> Option<Action> { |
|
29 |
self.actions.pop() |
|
30 |
} |
|
31 |
} |