First we import all necessary files.
In [ ]:
from indra.utils import get_props
from indra.agent import Agent
from indra.composite import Composite
from indra.space import DEF_HEIGHT, DEF_WIDTH
from indra.env import Env
from indra.display_methods import RED, BLUE
from models.height import set_up
We then initialize global variables.
In [ ]:
MODEL_NAME = "height"
DEBUG = True # turns debugging code on or off
DEBUG2 = False # turns deeper debugging code on or off
DEF_NUM_BLUE = 10
DEF_NUM_RED = 10
red_group = None
blue_group = None
env = None
Next we call the set_up function to set up the environment, groups, and agents of the model.
In [ ]:
(env, blue_group, red_group) = set_up()
You can run the model N periods by typing the number you want in the following function and then running it.
In [ ]:
env.runN()
You can view the position of all of the agents in space with the following command:
In [ ]:
env.scatter_graph()
You can view the line graph through the following command:
In [ ]:
env.line_graph()