From 8e7ac2814c4a92eba79f9c626ad14ac0b7bfef3f Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 26 Feb 2023 23:26:51 +0300 Subject: feat: add clock and time management to UCI --- src/clock.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/clock.rs (limited to 'src/clock.rs') diff --git a/src/clock.rs b/src/clock.rs new file mode 100644 index 0000000..896307a --- /dev/null +++ b/src/clock.rs @@ -0,0 +1,22 @@ +use std::time::Duration; + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct Clock { + pub time: [Duration; 2], // White, Black + pub increment: [Duration; 2], +} + +impl Default for Clock { + fn default() -> Self { + Self::new(Duration::from_secs(60 * 5), Duration::from_secs(3)) + } +} + +impl Clock { + pub fn new(time: Duration, increment: Duration) -> Self { + Self { + time: [time, time], + increment: [increment, increment], + } + } +} -- cgit v1.2.3