liquidwar7core 0.2.0

Liquidwar7 core logic library, low-level things which are game-engine agnostic.
Documentation
// Copyright (C) 2025 Christian Mauduit <ufoot@ufoot.org>

//! Game state trait for advancing game logic.
//!
//! This module contains the [`GameState`] trait which defines the interface
//! for any game state that can be advanced step by step.

/// Trait for game state that can be advanced by steps.
///
/// Implement this trait for your game world to allow it to be driven
/// by a [`GameHandler`](crate::GameHandler) which manages timing and step execution.
///
/// # Example
///
/// ```
/// use liquidwar7core::GameState;
///
/// struct MyGameState {
///     score: u32,
/// }
///
/// impl GameState for MyGameState {
///     fn do_step(&mut self, odd_even: bool, steps_count: u64) {
///         // Update game logic here
///         self.score += 1;
///     }
/// }
/// ```
pub trait GameState {
    /// Advances the game state by one step.
    ///
    /// # Arguments
    ///
    /// * `odd_even` - Alternates in a chaotic pattern to avoid systematic bias.
    /// * `steps_count` - The current step number, used for semi-random variations.
    fn do_step(&mut self, odd_even: bool, steps_count: u64);
}