no-log mode

This commit is contained in:
Vadzim Valchkovich 2023-06-15 21:32:49 +02:00
parent 47ba41d2ba
commit dae6ffb6f5

View File

@ -48,6 +48,7 @@ class Engine:
self.runnin: bool = False self.runnin: bool = False
self.paused: bool = False self.paused: bool = False
self.show_fringe: bool = False self.show_fringe: bool = False
self.is_simulation: bool = False
def build_field(self): def build_field(self):
s = self.square_size s = self.square_size
@ -79,11 +80,16 @@ class Engine:
def train_loop(self, stop_condition): def train_loop(self, stop_condition):
print(colored("Simulation started", "green")) print(colored("Simulation started", "green"))
real_action_duration = self.action_duration
self.action_duration = 0 self.action_duration = 0
self.is_simulation = True
while stop_condition(self.action_clock): while stop_condition(self.action_clock):
self.action() self.action()
self.action_duration = real_action_duration
self.is_simulation = False
return self.serviced_tables return self.serviced_tables
def user_interaction(self): def user_interaction(self):
@ -156,6 +162,9 @@ class Engine:
self.revoke_goal() self.revoke_goal()
def log_state(self, state: TemporaryState): def log_state(self, state: TemporaryState):
if self.is_simulation:
return
LOG_COLOR = "blue" LOG_COLOR = "blue"
print( print(
colored("Action:", LOG_COLOR), colored("Action:", LOG_COLOR),