mark points

This commit is contained in:
Henri Bourcereau 2024-03-26 21:07:47 +01:00
parent f61d2044f8
commit dff9f7f3e1
3 changed files with 12 additions and 5 deletions

View file

@ -28,6 +28,7 @@ fn transpose(matrix: Vec<Vec<String>>) -> Vec<Vec<String>> {
impl CheckerMove {
pub fn new(from: Field, to: Field) -> Result<Self, Error> {
println!("from {} to {}", from, to);
// check if the field is on the board
// we allow 0 for 'to', which represents the exit of a checker
if from < 1 || 24 < from || 24 < to {

View file

@ -448,7 +448,10 @@ impl GameState {
}
fn mark_points(&mut self, player_id: PlayerId, points: u8) {
todo!()
self.players.get_mut(&player_id).map(|p| {
p.points = p.points + points;
p
});
}
}