How to use the mesa.visualization.TextVisualization.TextGrid function in Mesa

To help you get started, we’ve selected a few Mesa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github projectmesa / mesa / examples / wolf_sheep / wolf_sheep / test_random_walk.py View on Github external
def __init__(self, model):
        '''
        Create a new visualization for a WalkerWorld instance.

        args:
            model: An instance of a WalkerWorld model.
        '''
        self.model = model
        grid_viz = TextGrid(self.model.grid, None)
        grid_viz.converter = lambda x: str(len(x))
        self.elements = [grid_viz]
github projectmesa / mesa / examples / Schelling / Schelling.py View on Github external
def __init__(self, model):
        '''
        Create new Schelling ASCII visualization.
        '''
        self.model = model

        grid_viz = TextGrid(self.model.grid, self.ascii_agent)
        happy_viz = TextData(self.model, 'happy')
        self.elements = [grid_viz, happy_viz]
github projectmesa / mesa / examples / schelling / run_ascii.py View on Github external
def __init__(self, model):
        '''
        Create new Schelling ASCII visualization.
        '''
        self.model = model

        grid_viz = TextGrid(self.model.grid, self.print_ascii_agent)
        happy_viz = TextData(self.model, 'happy')
        self.elements = [grid_viz, happy_viz]
github projectmesa / mesa / examples / Schelling / server.py View on Github external
def __init__(self, model):
        '''
        Create new Schelling ASCII visualization.
        '''
        self.model = model

        grid_viz = TextGrid(self.model.grid, self.ascii_agent)
        happy_viz = TextData(self.model, 'happy')
        self.elements = [grid_viz, happy_viz]
github projectmesa / mesa / examples / WolfSheep / WolfSheepVisualization.py View on Github external
def __init__(self, model):
        self.model = model
        grid_viz = TextGrid(self.model.grid, self.draw_cell)
        self.elements = [grid_viz]