feat: initial dice-wrapper structure and working prototype

This commit is contained in:
2026-03-16 00:11:07 -03:00
parent 6a154429e9
commit 30be88e6b4
8 changed files with 174 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
from diceplayer.config.player_config import PlayerConfig, RoutineType
from diceplayer.config.player_config import PlayerConfig
from diceplayer.dice.dice_handler import DiceHandler
from diceplayer.logger import logger
from diceplayer.optimization.optimization_handler import OptimizationHandler
@@ -22,13 +22,14 @@ class Player:
continuation = flags.get("continuation", False)
force = flags.get("force", False)
state: StateModel = self._state_handler.get(self.config, force=force)
state = 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=force)
state = None
if state is None:
state = StateModel.from_config(self.config)
@@ -44,9 +45,9 @@ class Player:
if not step_directory.exists():
step_directory.mkdir(parents=True)
state = DiceHandler.run(state, state.current_cycle)
state = DiceHandler(step_directory).run(state, state.current_cycle)
state = OptimizationHandler.run(state, state.current_cycle)
# state = OptimizationHandler.run(state, state.current_cycle)
state.current_cycle += 1
self._state_handler.save(state)