Spaces:
Sleeping
Sleeping
Deploy Myco from CI
Browse files- game/engine.py +19 -0
game/engine.py
CHANGED
|
@@ -148,6 +148,25 @@ def study_current(current: MushroomState | None, history: ChatHistory) -> tuple[
|
|
| 148 |
|
| 149 |
def eat_current(current: MushroomState | None, history: ChatHistory | None) -> ChatHistory:
|
| 150 |
"""Handle the Eat choice safely with Myco's companion personality."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
current_history = _safe_history(history)
|
| 152 |
if current is None:
|
| 153 |
return [
|
|
|
|
| 148 |
|
| 149 |
def eat_current(current: MushroomState | None, history: ChatHistory | None) -> ChatHistory:
|
| 150 |
"""Handle the Eat choice safely with Myco's companion personality."""
|
| 151 |
+
next_history = _safe_history(history)
|
| 152 |
+
|
| 153 |
+
if current is None:
|
| 154 |
+
next_history.append(
|
| 155 |
+
{
|
| 156 |
+
"role": "assistant",
|
| 157 |
+
"content": "Let's discover a mushroom before making snack decisions.",
|
| 158 |
+
}
|
| 159 |
+
)
|
| 160 |
+
return next_history
|
| 161 |
+
|
| 162 |
+
mushroom = mushroom_from_state(current)
|
| 163 |
+
message = (
|
| 164 |
+
f"Myco gently blocks the {mushroom.name}. "
|
| 165 |
+
f"Its edible field is still **{mushroom.edible}**, "
|
| 166 |
+
"so the winning move is to study or collect it instead of eating it."
|
| 167 |
+
)
|
| 168 |
+
next_history.append({"role": "assistant", "content": message})
|
| 169 |
+
return next_history
|
| 170 |
current_history = _safe_history(history)
|
| 171 |
if current is None:
|
| 172 |
return [
|