wip bevy tiles

This commit is contained in:
Henri Bourcereau 2023-11-05 17:14:58 +01:00
parent ac2f139dbc
commit a7bb630816
10 changed files with 82 additions and 7 deletions

View file

@ -2,7 +2,7 @@ use crate::player::{Player, Color};
use crate::Error;
use serde::{Deserialize, Serialize};
/// Represents the Backgammon board
/// Represents the Tric Trac board
///
/// A Tric-Trac board consists of 24 fields, each of which can hold 0 or more checkers.
///
@ -75,7 +75,7 @@ impl Board {
///
/// This method adds the amount of checkers for a player on a field. The field is numbered from
/// 0 to 23, starting from the last field of each player in the home board, the most far away
/// field for each player (where there are 2 checkers to start with) is number 23.
/// field for each player is number 23.
///
/// If the field is blocked for the player, an error is returned. If the field is not blocked,
/// but there is already one checker from the other player on the field, that checker is hit and

View file

@ -3,6 +3,7 @@ use crate::player::{Color, Player, PlayerId};
use crate::board::{Board, Move};
use crate::dice::{Dices, Roll};
use crate::Error;
use log::{error, info, trace, warn};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
@ -137,10 +138,12 @@ impl GameState {
Move { player_id, from, to } => {
// Check player exists
if !self.players.contains_key(player_id) {
error!("Player {} unknown", player_id);
return false;
}
// Check player is currently the one making their move
if self.active_player_id != *player_id {
error!("Player not active : {}", self.active_player_id);
return false;
}

View file

@ -2,7 +2,7 @@ mod game;
pub use game::{EndGameReason, GameEvent, GameState, Stage};
mod player;
pub use player::Player;
pub use player::{Player, Color};
mod error;
pub use error::Error;