feat: initial handler structures for player steps

This commit is contained in:
2026-03-15 11:15:18 -03:00
parent 9f22304dd8
commit 4c8cbc821d
4 changed files with 28 additions and 23 deletions

View File

@@ -0,0 +1,6 @@
from diceplayer.state.state_model import StateModel
class DiceHandler:
@staticmethod
def run(state: StateModel, current_cycle: int) -> StateModel: ...

View File

View File

@@ -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

View File

@@ -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