grimjim commited on
Commit
9d28c02
·
1 Parent(s): 7b39fc8

Rare escape

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -89,6 +89,15 @@ REVELATIONS = [
89
  "the player realizes the corridor is arranging itself around a thing they refuse to name",
90
  ]
91
 
 
 
 
 
 
 
 
 
 
92
  DIRECTIONS = {
93
  "north": (0, 1),
94
  "n": (0, 1),
@@ -247,10 +256,14 @@ def apply_turn(state: dict[str, Any], user_input: str) -> dict[str, Any]:
247
  entity_present = rng.random() < encounter_chance
248
  pressure = rng.choice(ENTITY_PRESSURES) if entity_present else None
249
  revelation = rng.choice(REVELATIONS) if entity_present and rng.randint(1, 4) == 1 else "none"
 
 
250
  if entity_present:
251
  base_loss += rng.choice([2, 3, 4])
252
  if revelation != "none":
253
  base_loss += 1
 
 
254
 
255
  state["sanity"] = max(0, min(100, state["sanity"] - base_loss))
256
  state["last_event"] = (
@@ -267,6 +280,7 @@ def apply_turn(state: dict[str, Any], user_input: str) -> dict[str, Any]:
267
  "encounter_mode": pressure["name"] if pressure else "none",
268
  "encounter_instruction": pressure["instruction"] if pressure else "none",
269
  "revelation": revelation,
 
270
  "ambient_noise": ambient_noise,
271
  "sanity_loss": base_loss,
272
  "zone": zone_profile(state["x"], state["y"]),
@@ -297,6 +311,7 @@ Hidden state:
297
  - Encounter mode: {turn["encounter_mode"]}
298
  - Encounter narration note: {turn["encounter_instruction"]}
299
  - Psychological revelation: {turn["revelation"]}
 
300
  - Ambient unexplained noise: {turn["ambient_noise"]}
301
  - Sanity erosion this turn: {turn["sanity_loss"]}
302
  - Prior event: {state["last_event"]}
@@ -309,6 +324,8 @@ note. Do not repeat stock phrases like "it is watching" or "you are getting clos
309
  If psychological revelation is not "none", make it the emotional turn of the
310
  scene: reveal it obliquely as a realization, memory, or pattern. Do not fully
311
  explain it.
 
 
312
  If ambient unexplained noise is not "none", weave it into the scene as a small
313
  unsettling detail without making it the whole turn.
314
  If sanity is low, make perception less reliable without naming sanity.
 
89
  "the player realizes the corridor is arranging itself around a thing they refuse to name",
90
  ]
91
 
92
+ ESCAPE_EVENTS = [
93
+ "an exit door opens onto the player's own bedroom, but the wallpaper continues across the ceiling",
94
+ "a fire escape stairwell appears, descending into warm daylight that smells like wet carpet",
95
+ "a service elevator arrives with the player's name taped over every floor button",
96
+ "a glass storefront shows an empty street outside, though the reflection does not match the player",
97
+ "a loading dock door rises to reveal a night sky with no stars and a familiar parked car",
98
+ "a stairwell landing contains a phone booth already ringing with the player's home number",
99
+ ]
100
+
101
  DIRECTIONS = {
102
  "north": (0, 1),
103
  "n": (0, 1),
 
256
  entity_present = rng.random() < encounter_chance
257
  pressure = rng.choice(ENTITY_PRESSURES) if entity_present else None
258
  revelation = rng.choice(REVELATIONS) if entity_present and rng.randint(1, 4) == 1 else "none"
259
+ escape_chance = 0.015 if state["turn"] >= 8 else 0.0
260
+ escape_event = rng.choice(ESCAPE_EVENTS) if rng.random() < escape_chance else "none"
261
  if entity_present:
262
  base_loss += rng.choice([2, 3, 4])
263
  if revelation != "none":
264
  base_loss += 1
265
+ if escape_event != "none":
266
+ base_loss += 2
267
 
268
  state["sanity"] = max(0, min(100, state["sanity"] - base_loss))
269
  state["last_event"] = (
 
280
  "encounter_mode": pressure["name"] if pressure else "none",
281
  "encounter_instruction": pressure["instruction"] if pressure else "none",
282
  "revelation": revelation,
283
+ "escape_event": escape_event,
284
  "ambient_noise": ambient_noise,
285
  "sanity_loss": base_loss,
286
  "zone": zone_profile(state["x"], state["y"]),
 
311
  - Encounter mode: {turn["encounter_mode"]}
312
  - Encounter narration note: {turn["encounter_instruction"]}
313
  - Psychological revelation: {turn["revelation"]}
314
+ - Possible escape: {turn["escape_event"]}
315
  - Ambient unexplained noise: {turn["ambient_noise"]}
316
  - Sanity erosion this turn: {turn["sanity_loss"]}
317
  - Prior event: {state["last_event"]}
 
324
  If psychological revelation is not "none", make it the emotional turn of the
325
  scene: reveal it obliquely as a realization, memory, or pattern. Do not fully
326
  explain it.
327
+ If possible escape is not "none", treat it as a rare climax: show the apparent
328
+ way out, but make it unsettling and ambiguous rather than triumphant.
329
  If ambient unexplained noise is not "none", weave it into the scene as a small
330
  unsettling detail without making it the whole turn.
331
  If sanity is low, make perception less reliable without naming sanity.