Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimum-Effort / Weakest-Link Interactive Experiment

Interactive browser experiment where one human plays a 50-round public-goods game against two AI automata calibrated from observed behavior in punnoise_data.csv.

Implemented game design

  • Group size: 3 players (You, AI-1, AI-2)
  • Rounds: 50 fixed rounds
  • Contribution action each round: 20 or 0
  • Stage-1 payoff per player:
    • If contribute 0: keep 20
    • All players receive 10 * (# contributors)
    • So: income_pg = (keep amount) + 10 * group_contributors
  • Monitoring:
    • Perfect: public record equals real contribution
    • Noisy: if real contribution = 20, public record flips to 0 with probability 10%
    • Real 0 always shows as 0
  • Punishment stage (treatment-dependent):
    • Each player can assign 0..5 points to each other player
    • Cost to punisher: 1 per point
    • Regular punishment: target loses 3 * received_points, capped by target income_pg
    • Strong punishment: target loses 6 * received_points, uncapped (can go negative)

Treatments available

  • Perfect + No punishment
  • Noisy + No punishment
  • Perfect + Regular punishment
  • Noisy + Regular punishment
  • Perfect + Strong punishment
  • Noisy + Strong punishment

AI automata behavior

Automata are stochastic and data-driven from data/behavior_policy.json:

  • Contribution probability by treatment, round bucket, and short memory state:
    • previous observed no-contribution count (0..2)
    • whether they were punished in prior round
    • their previous contribution
  • Punishment probability/intensity by treatment, round bucket, actor contribution, and target public signal

This policy JSON was extracted from your dataset with scripts/extract_policy.py.

Bot tuning config

Adaptive bot priors, learning rates, noise, and response sensitivities are in:

  • data/bot_config.json

You can tune these without editing source code.

policy_mode in config controls which policy is used:

  • belief (default, explainable model)
  • nn (offline-trained tiny neural network inference)

Calibrate smooth responses from policy data

node ./scripts/calibrate_response.mjs \
  --config ./data/bot_config.json \
  --policy ./data/behavior_policy.json \
  --out ./data/bot_config.calibrated.json

Then replace data/bot_config.json with the calibrated output if desired.

Optional NN policy (offline train, inference only)

Files:

  • src/bot_policy_nn.mjs (inference)
  • scripts/train_nn_policy.mjs (offline training)
  • data/nn_model.json (trained weights)

Feature set used by NN:

  • Contribution head: round index, estimated human cooperation probability, other-bot cooperation proxy, recent observed no-contribution signal, recent punishment signal, monitoring/punishment treatment indicators.
  • Punishment heads: target public no-contribution signal, actor contribution, recent trend proxy, free-rider belief mass, treatment indicators, and whether target is the human slot.

Train command:

node ./scripts/train_nn_policy.mjs \
  --input \"/Users/mac/Desktop/Thesis/8th Meeting - Online/Data/Data Imperfect Public Monitoring with Costly Punishment/AER-2010-1123_data/punnoise_data.csv\" \
  --output ./data/nn_model.json

To enable NN inference in game/harness, set in data/bot_config.json:

{
  "policy_mode": "nn",
  "nn_model_path": "./data/nn_model.json"
}

Run

  1. From the project root:
python3 -m http.server 8000
  1. Open http://localhost:8000

No build step required.

Regenerate policy from raw CSV

python3 ./scripts/extract_policy.py \
  --input "/Users/mac/Desktop/Thesis/8th Meeting - Online/Data/Data Imperfect Public Monitoring with Costly Punishment/AER-2010-1123_data/punnoise_data.csv" \
  --output "./data/behavior_policy.json"

Output

At the end of a session, click Download Results CSV. The exported file contains one row per player per round with contributions, public records, punishment, payoff components, and cumulative scores.

Headless Stress Test Harness

Run many no-UI sessions across bot and scripted-human settings:

node ./scripts/stress_test.mjs \
  --sessions 1000 \
  --rounds 50 \
  --modes all \
  --treatments all \
  --out-dir ./outputs

Modes:

  • bot_vs_bot
  • bot_vs_free_rider
  • bot_vs_conditional
  • bot_vs_random

Outputs (CSV):

  • outputs/stress_summary_<timestamp>.csv
  • outputs/stress_timeseries_<timestamp>.csv
  • outputs/stress_final_beliefs_<timestamp>.csv

Summary metrics include cooperation rates (overall/bots/human), punishment spent, welfare, and false-punishment rate under noisy monitoring.

About

Public Good Game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages