How to run the ../models/ex_boyfriend model.

First we import all necessary files.


In [ ]:
import random
from models.ex_boyfriend import set_up

We then initialize global variables.


In [ ]:
from indra.agent import Agent
from indra.composite import Composite
from indra.display_methods import RED, BLUE
from indra.env import Env
from indra.registry import get_env, get_prop
from indra.space import DEF_HEIGHT, DEF_WIDTH
from indra.utils import init_props

MODEL_NAME = "ex_boyfriend"
DEBUG = True  # turns debugging code on or off
DEBUG2 = False  # turns deeper debugging code on or off

# Girlfriend's State Strings
PICK_RANDOM = "Pick Random Cycle"
REPEAT_CYCLE = "Repeat Cycle"
CHANGE_DAY = "Change day"
SUCCESS = "Success"

# state numbers
PR = 0
RC = 1
CD = 2
SU = 3

NUM_STATES = 4

STATE_MAP = {PR: PICK_RANDOM, RC: REPEAT_CYCLE,
             CD: CHANGE_DAY, SU: SUCCESS}

DEF_NUM_BLUE = 1
DEF_NUM_RED = 1
DEF_CYCLE = 7

newly_freed_cycle = None
ex_boyfriend_start = None
newly_freed_start = None
period = None
boyfriend_going = False
day = None

Next we call the set_up function to set up the environment, groups, and agents of the model.


In [ ]:
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("bar",
.runN()

You can view the position of all of the agents in space with the following command:


In [ ]:
Env("bar",
.scatter_graph()

You can view the line graph through the following command:


In [ ]:
Env("bar",
.line_graph()