A Python simulation of a human-adaptive task environment that adjusts difficulty, pacing, and challenge level based on simulated user performance metrics.
This is a research-oriented prototype for demonstrating human-adaptive simulation architecture. It does not use real human data; the user is simulated with a small probabilistic model so the adaptation loop can be run locally and inspected easily.
Adaptive game and simulation systems often need to respond to human behavior while preserving a clean task loop. This project shows a compact version of that pattern: a user model produces behavior, metrics summarize recent performance, and an adaptive controller reconfigures task parameters.
The structure connects to adaptive environments, task reconfiguration, simulation architecture, reinforcement learning infrastructure, and agent-environment interfaces because the same controller pattern could be used with human-in-the-loop RL experiments, serious games, or behavioral simulation platforms.
- Simulated human user model with skill, fatigue, and consistency
- Task environment with difficulty, pacing, and challenge level
- Rolling metrics for success rate, error rate, reaction delay, and consistency
- Adaptive controller rules for increasing/decreasing difficulty and pacing
- Runtime logs showing adaptation decisions
- Matplotlib visualization saved to
outputs/performance_over_time.png - Basic tests for user behavior and adaptation rules
pip install -r requirements.txtRun the simulation:
python examples/run_simulation.pyRun tests:
python -m pytestThe simulation saves a plot to:
outputs/performance_over_time.png
It also writes trial-level logs to:
outputs/trial_logs.jsonl
Output files are generated locally and are not tracked in git.
After running, check the outputs/ directory for plots and logs.
The controller uses simple, inspectable rules:
| Signal | Adaptation |
|---|---|
| High success rate | Increase difficulty |
| High error rate | Decrease difficulty |
| Slow reaction delay | Slow task pacing |
| Stable performance | Introduce a new challenge |
Example log lines:
[adapt] trial=008 action=decrease_difficulty reason=error_rate=0.50 difficulty=0.27 pacing=1.04 challenge=1
[adapt] trial=019 action=increase_difficulty reason=success_rate=0.83 difficulty=0.25 pacing=1.15 challenge=1
flowchart LR
User["SimulatedUser"] --> Env["TaskEnvironment"]
Env --> Metrics["PerformanceMetrics"]
Metrics --> Controller["AdaptiveController"]
Controller --> Env
Env --> Logger["SimulationLogger"]
Metrics --> Plot["performance_over_time.png"]
The project separates behavior generation, environment state, metrics, and adaptation decisions. This keeps the simulation small while still reflecting the runtime structure of human-adaptive systems.
The rules are intentionally transparent rather than complex. That makes it easier to explain why an adaptation occurred and where a more advanced policy could be added later.
- Add configurable adaptation rules through YAML
- Add multiple user profiles with different skill and fatigue patterns
- Compare rule-based adaptation against a learned policy
- Add a Gymnasium-compatible wrapper for agent-based experiments