def create_with_target_structure(
         target: CoordinateList,
         strat: ClassVar[BasicStrategy] = SpineStrat):
     if not BasicSimulation.is_valid_structure(target):
         raise TargetError(target, 'Given target is not a valid structure')
     target = strat.configure_target(target)
     return BasicAnalyzerSimulation.create_base_sim(strat, target)
    def create_with_empty_states(num_states: int = 1):
        initial_state = BasicSimulation()
        states = BasicSimulationList(initial_state)
        for _ in range(num_states - 1):
            states.states.append(copy.deepcopy(initial_state))

        return states
 def load_run(self):
     strat = LoadStrat
     sim = BasicSimulation.create_with_target_structure([Coordinate(0, 0)], strat)
     file_name = self.load_box.get('1.0', 'end').strip('\n')
     sim.strategy.load(file_name)
     player = BasicPlayer(self.winfo_toplevel(), sim, BasicCreator, 'Create')
     player.grid()
     player.winfo_toplevel().title("RoboScaffold Sim")
     self.root_frame.destroy()
    def save(self):
        strat = strategies[self.creator.strat_chooser.strategy.get()]
        sim = BasicSimulation.create_with_target_structure(self.creator.struct, strat)
        states = BasicSimulationList(sim)
        states.update_loop(-1)

        file_name = self.save_text.get('1.0', 'end').strip('\n')
        with open(file_name, 'w') as file:
            states.save(file)
 def __init__(
     self, initial_state: BasicSimulation = BasicSimulation()) -> None:
     self._working_state: BasicSimulation = initial_state
     self.states: List[BasicSimulation] = [
         copy.deepcopy(self._working_state)
     ]
     self._b_blocks = 0
     self._s_blocks = 0
     self._last_check = 0
     self.robot_updates = 0
     self.scaffold_placements = 0
     self.build_placements = 0
     self.block_updates = 0
 def __init__(self,
              start_state: SimulationState = SimulationState(),
              strategy: ClassVar[BasicStrategy] = SpineStrat) -> None:
     BasicSimulation.__init__(self, start_state, strategy)
     self.sim_state = start_state
     self.strategy = strategy(start_state)
 def start_new(self):
     popup = tk.Toplevel()
     strat = strategies[self.creator.strat_chooser.strategy.get()]
     sim = BasicSimulation.create_with_target_structure(self.creator.struct, strat)
     player = BasicPlayer(popup, sim, BasicCreator, 'Create')
     player.grid()
 def start(self):
     strat = strategies[self.creator.strat_chooser.strategy.get()]
     sim = BasicSimulation.create_with_target_structure(self.creator.struct, strat)
     player = BasicPlayer(self.winfo_toplevel(), sim, BasicCreator, 'Create')
     player.grid()
     self.creator.destroy()
import tkinter as tk

from roboscaffold_sim.coordinate import Coordinate
from roboscaffold_sim.simulators.basic_simulator import BasicSimulation
from roboscaffold_sim.veiw.basic_player import BasicPlayer


sim = BasicSimulation.create_with_target_structure([Coordinate(5, 5)])

root = tk.Tk()
player = BasicPlayer(root, sim, load_to=100)
player.grid()
root.mainloop()