feat: 添加观点传播系统

- 新增 Stance 数据结构 (optimism/fear)
- 情绪影响 stance (happy→乐观, anxious→恐惧)
- 实现 apply_social_influence 社交影响函数
- 确定性随机选择接触对象
- 单次变化限制 ±0.1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2025-12-30 10:50:46 +08:00
parent af279bedd9
commit 554d37fd4c
6 changed files with 245 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import json
from pathlib import Path
from .models import WorldState, AgentState, GlobalMeter
from .models import WorldState, AgentState, GlobalMeter, Stance
STATE_FILE = Path(__file__).parent.parent / "state.json"
@@ -12,8 +12,18 @@ def get_default_state() -> WorldState:
weather="sunny",
town_mood=0,
agents={
"alice": AgentState(emotion="calm", goal="探索小镇", memory=[]),
"bob": AgentState(emotion="calm", goal="与人交流", memory=[]),
"alice": AgentState(
emotion="calm",
goal="探索小镇",
memory=[],
stance=Stance(optimism=0.6, fear=0.4),
),
"bob": AgentState(
emotion="calm",
goal="与人交流",
memory=[],
stance=Stance(optimism=0.4, fear=0.6),
),
},
events=[],
global_meter=GlobalMeter(value=0, threshold=100, cooldown=0),