diff --git a/diceplayer/dice/dice_handler.py b/diceplayer/dice/dice_handler.py index d2bf3ee..2842e77 100644 --- a/diceplayer/dice/dice_handler.py +++ b/diceplayer/dice/dice_handler.py @@ -3,4 +3,6 @@ from diceplayer.state.state_model import StateModel class DiceHandler: @staticmethod - def run(state: StateModel, current_cycle: int) -> StateModel: ... \ No newline at end of file + def run(state: StateModel, current_cycle: int) -> StateModel: + print(f"Running Dice - {current_cycle}") + return state diff --git a/diceplayer/optimization/optimization_handler.py b/diceplayer/optimization/optimization_handler.py index 0960315..9d0d86a 100644 --- a/diceplayer/optimization/optimization_handler.py +++ b/diceplayer/optimization/optimization_handler.py @@ -4,7 +4,9 @@ from diceplayer.state.state_model import StateModel class OptimizationHandler: @staticmethod - def run(state: StateModel, current_cycle: int) -> StateModel: ... + def run(state: StateModel, current_cycle: int) -> StateModel: + print(f"Running Optimization - {current_cycle}") + return state @staticmethod def _fetch_current_routine(state: StateModel, current_cycle: int) -> RoutineType: diff --git a/diceplayer/player.py b/diceplayer/player.py index 57acf72..b2ce936 100644 --- a/diceplayer/player.py +++ b/diceplayer/player.py @@ -19,13 +19,16 @@ class Player: self._state_handler = StateHandler(config.simulation_dir) def play(self, **flags: Unpack[PlayerFlags]): - if not flags["continuation"]: + continuation = flags.get("continuation", False) + force = flags.get("force", False) + + state: StateModel = self._state_handler.get(self.config, force=force) + if not continuation and state is not None: logger.info( "Continuation flag is not set. Starting a new simulation and deleting any existing state." ) self._state_handler.delete() - - state = self._state_handler.get(self.config, force=flags["force"]) + state = self._state_handler.get(self.config, force=force) if state is None: state = StateModel.from_config(self.config) @@ -37,7 +40,7 @@ class Player: f"Starting cycle {state.current_cycle + 1} of {self.config.max_cyc}." ) - step_directory = self.config.simulation_dir / f"{state.current_cycle::02d}" + step_directory = self.config.simulation_dir / f"{state.current_cycle:02d}" if not step_directory.exists(): step_directory.mkdir(parents=True)