Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/hex_ant/app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import matplotlib.pyplot as plt
from agent import AntState
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
from mesa.visualization import SolaraViz, make_space_component
from mesa.visualization.components import PropertyLayerStyle

from .agent import AntState
from .model import AntForaging
from model import AntForaging

plt.rcParams["figure.figsize"] = (10, 10)

Expand Down
3 changes: 1 addition & 2 deletions examples/hex_ant/model.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import mesa
from agent import Ant
from mesa.discrete_space import HexGrid

from .agent import Ant


class AntForaging(mesa.Model):
"""
Expand Down
21 changes: 21 additions & 0 deletions examples/hex_snowflake/hex_snowflake/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from hex_snowflake.cell import Cell
from hex_snowflake.model import HexSnowflake
from mesa.visualization import SolaraViz, make_space_component


def agent_portrayal(agent):
if agent is None:
return

if isinstance(agent, Cell):
color = "tab:green" if agent.state == Cell.ALIVE else "tab:grey"
return {"color": color, "size": 20}


model = HexSnowflake()

page = SolaraViz(
model,
components=[make_space_component(agent_portrayal=agent_portrayal)],
name="Hex Snowflake",
)
17 changes: 0 additions & 17 deletions examples/hex_snowflake/hex_snowflake/portrayal.py

This file was deleted.

12 changes: 0 additions & 12 deletions examples/hex_snowflake/hex_snowflake/server.py

This file was deleted.

3 changes: 0 additions & 3 deletions examples/hex_snowflake/run.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from hex_snowflake.server import server

server.launch(open_browser=True)