mark points
This commit is contained in:
parent
f61d2044f8
commit
dff9f7f3e1
3 changed files with 12 additions and 5 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue