diff --git a/pooltool/ani/animate.py b/pooltool/ani/animate.py index 89c97415..a609e237 100755 --- a/pooltool/ani/animate.py +++ b/pooltool/ani/animate.py @@ -28,6 +28,7 @@ from pooltool.ani.menu import GenericMenu, menus from pooltool.ani.modes import Mode, ModeManager, all_modes from pooltool.ani.mouse import mouse +from pooltool.evolution import simulate from pooltool.evolution.continuize import continuize from pooltool.game.datatypes import GameType from pooltool.layouts import get_rack @@ -518,6 +519,16 @@ def enter_game(self): if ani.settings["graphics"]["hud"]: hud.init() + code_comp_menu = GenericMenu( + title="Compiling simulation code...", + frame_color=(0, 0, 0, 0.4), + title_pos=(0, 0, 0), + ) + code_comp_menu.show() + boop(2) + simulate(System.example(), inplace=True) + code_comp_menu.hide() + Global.mode_mgr.change_mode(Mode.aim) def create_system(self): diff --git a/pooltool/ani/modes/calculate.py b/pooltool/ani/modes/calculate.py index 19c969fe..0e0aa83c 100644 --- a/pooltool/ani/modes/calculate.py +++ b/pooltool/ani/modes/calculate.py @@ -9,7 +9,7 @@ from pooltool.ani.modes.datatypes import BaseMode, Mode from pooltool.ani.mouse import MouseMode, mouse from pooltool.evolution import simulate -from pooltool.system.datatypes import multisystem +from pooltool.system.datatypes import System, multisystem class CalculateMode(BaseMode): @@ -30,7 +30,13 @@ def enter(self): title_pos=(0, 0, -0.2), ) - tasks.add(self.run_simulation, "run_simulation", taskChain="simulation") + tasks.add( + self.run_simulation, + "run_simulation", + extraArgs=[multisystem.active], + taskChain="simulation", + appendTask=True, + ) self.register_keymap_event("escape", Action.quit, True) self.register_keymap_event("mouse1", Action.zoom, True) @@ -74,11 +80,11 @@ def calculate_view_task(self, task): return task.cont - def run_simulation(self, task): + def run_simulation(self, system: System, task): """Run a pool simulation""" simulate( - multisystem.active, + system, continuous=True, inplace=True, ) diff --git a/pooltool/system/datatypes.py b/pooltool/system/datatypes.py index 1a54a812..d5a6c120 100644 --- a/pooltool/system/datatypes.py +++ b/pooltool/system/datatypes.py @@ -573,7 +573,7 @@ def example(cls) -> System: }, ) system.set_ballset(BallSet("pooltool_pocket")) - system.cue.set_state(V0=1.5, b=-0.3, phi=95.07668213305062) + system.cue.set_state(V0=1.5, b=-0.3, a=-0.4, phi=95.14) return system