Ready to implement boats layout check
This commit is contained in:
@@ -272,6 +272,12 @@ impl BoatsLayout {
|
||||
pub fn number_of_boats(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
||||
/// Check for layout invalid configuration
|
||||
pub fn layouts_errors(&self, _rules: &GameRules) -> Vec<&'static str> {
|
||||
//TODO : implement
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -4,13 +4,13 @@ use rand::RngCore;
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct CurrentGameStatus {
|
||||
pub rules: GameRules,
|
||||
// TODO
|
||||
//TODO
|
||||
}
|
||||
|
||||
impl CurrentGameStatus {
|
||||
/// Check if user can fire at a given location
|
||||
pub fn can_fire_at_location(&self, _location: Coordinates) -> bool {
|
||||
// TODO
|
||||
//TODO
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::consts::*;
|
||||
use crate::data::{BotType, PlayConfiguration};
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone)]
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
pub struct GameRules {
|
||||
pub map_width: usize,
|
||||
pub map_height: usize,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::consts::*;
|
||||
|
||||
/// Specifies the kind of boat to use
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Copy, Clone)]
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Copy, Clone, Eq, PartialEq)]
|
||||
pub enum BotType {
|
||||
Random,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user