feat: trous selon bredouille
This commit is contained in:
parent
3d41517909
commit
fc58768006
|
|
@ -448,8 +448,14 @@ impl GameState {
|
||||||
fn mark_points(&mut self, player_id: PlayerId, points: u8) {
|
fn mark_points(&mut self, player_id: PlayerId, points: u8) {
|
||||||
self.players.get_mut(&player_id).map(|p| {
|
self.players.get_mut(&player_id).map(|p| {
|
||||||
let sum_points = p.points + points;
|
let sum_points = p.points + points;
|
||||||
|
let jeux = sum_points / 12;
|
||||||
|
|
||||||
p.points = 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
|
p
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue