From fc587680061c671f93cafff6cba8450347b5dc78 Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Tue, 24 Sep 2024 17:44:45 +0200 Subject: [PATCH] feat: trous selon bredouille --- store/src/game.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/store/src/game.rs b/store/src/game.rs index f36cf61..ae4963f 100644 --- a/store/src/game.rs +++ b/store/src/game.rs @@ -448,8 +448,14 @@ impl GameState { fn mark_points(&mut self, player_id: PlayerId, points: u8) { self.players.get_mut(&player_id).map(|p| { let sum_points = p.points + points; + let jeux = sum_points / 12; + p.points = sum_points % 12; - p.holes += sum_points / 12; + p.holes += match (jeux, p.can_bredouille) { + (0, _) => 0, + (_, false) => 2 * jeux - 1, + (_, true) => 2 * jeux, + }; p }); }