From 42192a7783a416c51f63a6268a7e592f6d1b3dc8 Mon Sep 17 00:00:00 2001 From: galenseilis Date: Sun, 26 May 2024 21:27:59 -0700 Subject: [PATCH] Simplified first example --- docs/index.md | 19 ++++--------------- examples/example_0.py | 19 ++++--------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/docs/index.md b/docs/index.md index e6a6b8e..f194f74 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,20 +22,9 @@ class CustomEvent(core.Event): """Execution logic of the custom event.""" print(f"Custom event executed at time {env.now}") -class Simulation: - """Simple simulation example.""" - - def __init__(self) -> None: - """Initialize the simulation environment.""" - self.env = core.Environment() - - def run_simulation(self) -> None: - """Run the simulation.""" - event = CustomEvent(5) # Schedule the custom event at time 5 - self.env.schedule_event(event) - self.env.run(10) # Run the simulation for 10 time units - if __name__ == "__main__": - sim = Simulation() - sim.run_simulation() + env = core.Environment() # Initialize the simulation environment + event = CustomEvent(5) # Schedule the custom event at time 5 + env.schedule_event(event) + env.run(10) # Run the simulation for 10 time units ``` diff --git a/examples/example_0.py b/examples/example_0.py index a47b6b7..7aa65f0 100644 --- a/examples/example_0.py +++ b/examples/example_0.py @@ -7,20 +7,9 @@ def execute(self, env) -> None: """Execution logic of the custom event.""" print(f"Custom event executed at time {env.now}") -class Simulation: - """Simple simulation example.""" - - def __init__(self) -> None: - """Initialize the simulation environment.""" - self.env = core.Environment() - - def run_simulation(self) -> None: - """Run the simulation.""" - event = CustomEvent(5) # Schedule the custom event at time 5 - self.env.schedule_event(event) - self.env.run(10) # Run the simulation for 10 time units - if __name__ == "__main__": - sim = Simulation() - sim.run_simulation() + env = core.Environment() # Initialize the simulation environment + event = CustomEvent(5) # Schedule the custom event at time 5 + env.schedule_event(event) + env.run(10) # Run the simulation for 10 time units