From 9abfca43ffdb600557956d41d2d936bcdcb15386 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 20 Mar 2021 21:28:43 +0000 Subject: [PATCH] clock: Give Y an extra per_move This breaks detection of whether we're reset. We'll fix that in a moment. Signed-off-by: Ian Jackson --- src/clock.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/clock.rs b/src/clock.rs index 675c0a93..27a8690e 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -115,6 +115,11 @@ impl State { for ust in &mut self.users { ust.remaining = spec.initial_time(); } + // White is player Y, and they will ge to go first, so the clock + // will go from stopped to Y, and then later when it's X's turn + // X will get an extra per_move. Y therefore needs per_move too. + let y_remaining = &mut self.users[USERS[0]].remaining; + *y_remaining = *y_remaining + TVL::seconds(spec.per_move.into()); } fn implies_running(&self, held: Option) -> Option { -- 2.30.2