|
| 1 | +# Game of Dice Task |
| 2 | + |
| 3 | +| Field | Value | |
| 4 | +|---|---| |
| 5 | +| Name | Game of Dice Task | |
| 6 | +| Version | v0.1.0-dev | |
| 7 | +| URL / Repository | https://github.com/TaskBeacon/T000037-game-of-dice | |
| 8 | +| Short Description | Chinese explicit-risk dice gambling task with four known-probability options and cumulative capital feedback. | |
| 9 | +| Created By | TaskBeacon build pipeline | |
| 10 | +| Date Updated | 2026-04-03 | |
| 11 | +| PsyFlow Version | local checkout | |
| 12 | +| PsychoPy Version | 2025.1.1 | |
| 13 | +| Modality | Behavior | |
| 14 | +| Language | Chinese | |
| 15 | +| Voice Name | zh-CN-YunyangNeural | |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +## 1. Task Overview |
| 20 | + |
| 21 | +Participants complete an explicit-risk dice betting task with four visible gamble options on each trial. Each option corresponds to betting on 1, 2, 3, or 4 die faces with fixed win/loss magnitudes and known probabilities. The task tracks cumulative capital starting at 1000 points, shows the sampled die result after each valid choice, and then displays win/loss feedback with the updated total. Human mode uses 18 trials in a single block, while QA and simulation configs use shorter 8-trial preview runs for fast validation. |
| 22 | + |
| 23 | +## 2. Task Flow |
| 24 | + |
| 25 | +### Block-Level Flow |
| 26 | + |
| 27 | +| Step | Description | |
| 28 | +|---|---| |
| 29 | +| Load config | `main.py` loads `config/config.yaml` or the mode-specific QA/sim variant and prepares the task settings. | |
| 30 | +| Collect subject info | Human mode collects `subject_id`; QA uses a deterministic stand-in value and sim mode uses the runtime session participant id. | |
| 31 | +| Initialize runtime | Triggers, window, keyboard, stimulus bank, and optional instruction voice are initialized. | |
| 32 | +| Initialize capital | The running capital state starts at 1000 points and is stored on `settings`. | |
| 33 | +| Show instructions | The Chinese instruction screen is shown before the trial block begins. | |
| 34 | +| Generate conditions | `BlockUnit.generate_conditions(...)` repeats the single `gdt_standard` condition across the block. | |
| 35 | +| Run trials | `run_trial(...)` executes fixation, choice, outcome, feedback, and ITI phases for each trial. | |
| 36 | +| Save data | Trial rows are written to CSV and the settings snapshot is saved to JSON. | |
| 37 | +| Finalize | The end trigger is emitted, the goodbye screen is closed, and PsychoPy exits. | |
| 38 | + |
| 39 | +### Trial-Level Flow |
| 40 | + |
| 41 | +| Step | Description | |
| 42 | +|---|---| |
| 43 | +| Fixation | A central fixation cross is shown briefly. | |
| 44 | +| Choice screen | The current total, prompt, and four risk cards are shown; the participant presses `1`-`4`. | |
| 45 | +| Outcome reveal | If a valid response was made, the sampled die roll and selected option are shown. | |
| 46 | +| Feedback | If a valid response was made, the win/loss message and updated capital are shown. | |
| 47 | +| Timeout branch | If the response window expires, the trial logs `timeout=true`, skips outcome/feedback, and keeps capital unchanged. | |
| 48 | +| ITI | A short fixation interval separates trials. | |
| 49 | + |
| 50 | +### Controller Logic |
| 51 | + |
| 52 | +| Feature | Description | |
| 53 | +|---|---| |
| 54 | +| Condition scheduling | A single repeated `gdt_standard` label is scheduled by PsyFlow block generation. | |
| 55 | +| Capital tracking | `settings.current_capital` and `settings.total_score` are updated after each valid outcome. | |
| 56 | +| Response contract | Keys `1`-`4` select the four gamble options; the same keys are used in QA/sim. | |
| 57 | +| Adaptive control | None. This is a static explicit-risk task, not a staircase or reversal task. | |
| 58 | + |
| 59 | +### Other Logic |
| 60 | + |
| 61 | +| Feature | Description | |
| 62 | +|---|---| |
| 63 | +| Deterministic roll | `trial_seed(...)` combines the block seed, block index, trial id, and choice key to produce a reproducible six-sided roll. | |
| 64 | +| Outcome evaluation | `compute_choice_outcome(...)` maps the selected option to win/loss magnitude, reward sign, and capital update. | |
| 65 | +| Advantageous choice flag | Options with 3 or 4 die faces are marked as advantageous/safe choices for summary reporting. | |
| 66 | +| Trial summary | `summarize_gdt_trials(...)` computes win rate, advantageous-choice rate, timeout count, RT, and final capital. | |
| 67 | + |
| 68 | +## 3. Configuration Summary |
| 69 | + |
| 70 | +Settings are defined in `config/config.yaml` and mode-specific variants for QA and simulation. |
| 71 | + |
| 72 | +### a. Subject Info |
| 73 | + |
| 74 | +| Field | Meaning | |
| 75 | +|---|---| |
| 76 | +| `subject_id` | Numeric participant identifier collected in human mode and injected deterministically in QA/sim modes. | |
| 77 | + |
| 78 | +### b. Window Settings |
| 79 | + |
| 80 | +| Parameter | Value | |
| 81 | +|---|---| |
| 82 | +| `window.size` | `[1280, 720]` | |
| 83 | +| `window.units` | `pix` | |
| 84 | +| `window.screen` | `0` | |
| 85 | +| `window.bg_color` | `black` | |
| 86 | +| `window.fullscreen` | `false` | |
| 87 | +| `window.monitor_width_cm` | `35.5` | |
| 88 | +| `window.monitor_distance_cm` | `60` | |
| 89 | + |
| 90 | +### c. Stimuli |
| 91 | + |
| 92 | +| Name | Type | Description | |
| 93 | +|---|---|---| |
| 94 | +| `instruction_text` | text | Chinese instructions describing the four dice betting options and the 1000-point starting capital. | |
| 95 | +| `fixation` | text | Central fixation cross shown before choice and during ITI. | |
| 96 | +| `capital_banner` | text | Current total capital shown at the top of the choice screen. | |
| 97 | +| `choice_prompt` | text | Prompt asking the participant to choose one of the four options. | |
| 98 | +| `option_1` / `option_2` / `option_3` / `option_4` | text | Four explicit-risk gamble cards with 1/6, 2/6, 3/6, and 4/6 probabilities. | |
| 99 | +| `outcome_text` | text | Die roll reveal and selected option label. | |
| 100 | +| `feedback_win` | text | Win feedback with the point gain and updated capital. | |
| 101 | +| `feedback_loss` | text | Loss feedback with the point loss and updated capital. | |
| 102 | +| `end_summary` | text | Final total capital shown at task completion. | |
| 103 | + |
| 104 | +### d. Timing |
| 105 | + |
| 106 | +| Phase | Duration | |
| 107 | +|---|---| |
| 108 | +| `timing.fixation_duration` | `0.5 s` | |
| 109 | +| `timing.choice_duration` | `10.0 s` in human mode, `8.0 s` in QA/sim configs | |
| 110 | +| `timing.outcome_duration` | `0.9 s` | |
| 111 | +| `timing.feedback_duration` | `1.0 s` | |
| 112 | +| `timing.iti_duration` | `0.8 s` | |
| 113 | + |
| 114 | +### e. Triggers |
| 115 | + |
| 116 | +| Event | Code | |
| 117 | +|---|---| |
| 118 | +| `exp_onset` | `1` | |
| 119 | +| `exp_end` | `2` | |
| 120 | +| `block_onset` | `10` | |
| 121 | +| `block_end` | `11` | |
| 122 | +| `fixation_onset` | `20` | |
| 123 | +| `choice_onset` | `30` | |
| 124 | +| `choice_response_key` | `31` | |
| 125 | +| `choice_timeout` | `32` | |
| 126 | +| `outcome_onset` | `40` | |
| 127 | +| `feedback_onset` | `50` | |
| 128 | +| `iti_onset` | `60` | |
| 129 | + |
| 130 | +### f. Adaptive Controller |
| 131 | + |
| 132 | +| Parameter | Value | |
| 133 | +|---|---| |
| 134 | +| `task.conditions` | `gdt_standard` repeated across the block | |
| 135 | +| `task.condition_weights` | `null` | |
| 136 | +| `task.key_list` | `[1, 2, 3, 4]` | |
| 137 | +| `task.seed_mode` | `same_across_sub` | |
| 138 | +| `task.roll_seed_mode` | `same_across_sub` | |
| 139 | +| `task.initial_capital` | `1000` | |
| 140 | +| `Adaptive controller` | None; the task uses static condition scheduling and deterministic outcome helpers. | |
| 141 | + |
| 142 | +## 4. Methods (for academic publication) |
| 143 | + |
| 144 | +Participants completed a computerized explicit-risk gambling task implemented in PsychoPy/PsyFlow. On each trial, they chose one of four gambles with known success probabilities and fixed win/loss magnitudes. The participant-facing choice screen displayed the current capital, the four gamble cards, and a single response prompt, while the subsequent outcome screen revealed the sampled die roll and the selected option. |
| 145 | + |
| 146 | +The task operationalizes risk preference through repeated choice behavior and capital accumulation. A valid choice triggers a deterministic die roll derived from a stable seed, followed by win/loss feedback and an updated capital display. If no response is made within the choice window, the trial is logged as a timeout and the capital remains unchanged, preserving the one-trial-one-row analysis contract without fabricating an outcome. |
| 147 | + |
| 148 | +All participant-facing wording is defined in YAML stimulus templates so the same trial logic can be reused across human, QA, and simulation modes without code edits. The human configuration runs 18 trials in one block, whereas QA and simulation configurations shorten the run to 8 trials to support fast validation while preserving the same state sequence, response mapping, and scoring rules. |
0 commit comments