Skip to content

Commit

Permalink
Minimal solara app with access to all three current mesa models
Browse files Browse the repository at this point in the history
  • Loading branch information
rlskoeser committed Oct 10, 2023
1 parent 7214426 commit 28b4945
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
33 changes: 33 additions & 0 deletions simulatingrisk/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import solara

from simulatingrisk.hawkdove.app import page as hawkdove_page
from simulatingrisk.risky_bet.app import page as riskybet_page
from simulatingrisk.risky_food.app import page as riskyfood_page


@solara.component
def Home():
solara.Markdown("Home")


@solara.component
def hawkdove():
return hawkdove_page


@solara.component
def riskybet():
return riskybet_page


@solara.component
def riskyfood():
return riskyfood_page


routes = [
solara.Route(path="/", component=Home, label="home"),
solara.Route(path="hawkdove", component=hawkdove, label="Hawk/Dove"),
solara.Route(path="riskybet", component=riskybet, label="Risky Bet"),
solara.Route(path="riskyfood", component=riskybet, label="Risky Food"),
]
4 changes: 1 addition & 3 deletions simulatingrisk/hawkdove/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import solara
import pandas as pd

from simulatingrisk.hawkdove.model import Play
from simulatingrisk.hawkdove.model import Play, divergent_colors_9, divergent_colors_5


def agent_portrayal(agent):
from simulatingrisk.hawkdove.model import divergent_colors_9, divergent_colors_5

# initial display
portrayal = {
# styles for mesa runserver
Expand Down
6 changes: 3 additions & 3 deletions simulatingrisk/risky_bet/server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import math

import mesa
from simulatingrisk.risky_bet.model import divergent_colors


def risk_index(risk_level):
Expand All @@ -21,9 +24,6 @@ def risk_index(risk_level):


def agent_portrayal(agent):
import math
from simulatingrisk.risky_bet.model import divergent_colors

# initial display
portrayal = {
# styles for mesa runserver
Expand Down

0 comments on commit 28b4945

Please sign in to comment.