forked from projectmesa/mesa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53fd9d2
commit 1413579
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Useful Snippets | ||
=============== | ||
|
||
A collection of useful code snippets. Here you can find code that allows you to get to get started on common tasks in Mesa. | ||
|
||
Models with Discrete Time | ||
------------------------- | ||
If you have `Multiple` type agents and one of them has time attribute you can still build a model that is run by discrete time. In this example, each step of the model, and the agents have a time attribute that is equal to the discrete time to run its own step. | ||
|
||
.. code:: python | ||
if self.model.schedule.time in self.discrete_time: | ||
self.model.space.move_agent(self, new_pos) |