elevator_core/components/
patience.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
7pub struct Patience {
8 pub(crate) max_wait_ticks: u64,
10 pub(crate) waited_ticks: u64,
12}
13
14impl Patience {
15 #[must_use]
17 pub const fn max_wait_ticks(&self) -> u64 {
18 self.max_wait_ticks
19 }
20
21 #[must_use]
23 pub const fn waited_ticks(&self) -> u64 {
24 self.waited_ticks
25 }
26}
27
28impl Default for Patience {
29 fn default() -> Self {
30 Self {
31 max_wait_ticks: 600,
32 waited_ticks: 0,
33 }
34 }
35}
36
37#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
39pub struct Preferences {
40 pub(crate) skip_full_elevator: bool,
42 pub(crate) max_crowding_factor: f64,
44}
45
46impl Preferences {
47 #[must_use]
49 pub const fn skip_full_elevator(&self) -> bool {
50 self.skip_full_elevator
51 }
52
53 #[must_use]
55 pub const fn max_crowding_factor(&self) -> f64 {
56 self.max_crowding_factor
57 }
58}
59
60impl Default for Preferences {
61 fn default() -> Self {
62 Self {
63 skip_full_elevator: false,
64 max_crowding_factor: 0.8,
65 }
66 }
67}