diff --git a/diceplayer/dice/dice_handler.py b/diceplayer/dice/dice_handler.py index e69de29..d2bf3ee 100644 --- a/diceplayer/dice/dice_handler.py +++ b/diceplayer/dice/dice_handler.py @@ -0,0 +1,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 diff --git a/diceplayer/optimization/__init__.py b/diceplayer/optimization/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/diceplayer/optimization/optimization_handler.py b/diceplayer/optimization/optimization_handler.py new file mode 100644 index 0000000..0960315 --- /dev/null +++ b/diceplayer/optimization/optimization_handler.py @@ -0,0 +1,17 @@ +from diceplayer.config.player_config import RoutineType +from diceplayer.state.state_model import StateModel + + +class OptimizationHandler: + @staticmethod + def run(state: StateModel, current_cycle: int) -> StateModel: ... + + @staticmethod + def _fetch_current_routine(state: StateModel, current_cycle: int) -> RoutineType: + if state.config.type != RoutineType.BOTH: + return state.config.type + + if current_cycle < state.config.switch_cyc: + return RoutineType.CHARGE + + return RoutineType.GEOMETRY \ No newline at end of file diff --git a/diceplayer/player.py b/diceplayer/player.py index 2044836..57acf72 100644 --- a/diceplayer/player.py +++ b/diceplayer/player.py @@ -1,5 +1,7 @@ from diceplayer.config.player_config import PlayerConfig, RoutineType +from diceplayer.dice.dice_handler import DiceHandler from diceplayer.logger import logger +from diceplayer.optimization.optimization_handler import OptimizationHandler from diceplayer.state.state_handler import StateHandler from diceplayer.state.state_model import StateModel @@ -39,31 +41,11 @@ class Player: if not step_directory.exists(): step_directory.mkdir(parents=True) - current_routine = self._fetch_current_routine(state.current_cycle) - if current_routine == RoutineType.CHARGE: - self._charge_opt_routine(state) - elif current_routine == RoutineType.GEOMETRY: - self._geometry_opt_routine(state) - else: - logger.error(f"Invalid routine type: {current_routine}") - return + state = DiceHandler.run(state, state.current_cycle) + + state = OptimizationHandler.run(state, state.current_cycle) state.current_cycle += 1 self._state_handler.save(state) logger.info("Reached maximum number of cycles. Simulation complete.") - - def _fetch_current_routine(self, current_cycle: int) -> RoutineType: - if self.config.type != RoutineType.BOTH: - return self.config.type - - if current_cycle < self.config.switch_cyc: - return RoutineType.CHARGE - - return RoutineType.GEOMETRY - - def _charge_opt_routine(self, state: StateModel) -> None: - pass - - def _geometry_opt_routine(self, state: StateModel) -> None: - pass