Commit ·
1ce3dc3
1
Parent(s): 10e348e
Outcome: 2s minimum view then Space-to-advance (not auto); practice tip on feedback
Browse files- outcome no longer auto-advances: keys locked for OUTCOME_HOLD_MS, then a 'Press SPACE'
prompt appears and Space advances. Arrows are swallowed during the outcome so they can't
reset the wait; Space is blocked until the wait elapses.
- practice teaching tip now shows during the amount-feedback (OUTCOME), not the choice
(choice screen is clean)
- HOW_TO_PLAY updated to describe the Press-SPACE behaviour
- also updated the GitLab data-repo README (separate, via API)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Files changed (2)
- experiment_structure.py+9-8
- web_app.py+27-12
471 unmodified lines472473474475476477478479480481118 unmodified lines60060160260360460560660760860961081 unmodified lines692693694695696697698699471 unmodified linesT(d, W // 2, 8, _earn(s_out, "YOURSELF"), size=18, bold=True, fill=accent, center=True, outline=True)T(d, W // 2, 34, _earn(o_out, "your PARTNER"), size=18, bold=True, fill=accent, center=True, outline=True)# ---- practice: a rotating teaching tip, shown ONLY while choosing (not during the# amount-feedback period), in the gap below the table legs (end floor_y+40) and# above the bottom YOU/PARTNER labels (at H-98) ----if practice and mode == M_CHOICE:tip = PRACTICE_TIPS[trial % len(PRACTICE_TIPS)]T(d, W // 2, floor_y + 62, tip, size=13, bold=True, fill=(255, 120, 120),center=True, outline=True)118 unmodified linesdef _arm_outcome_autoclose(mode):"""Arm (OUTCOME) or cancel (any other screen) the auto-close + key lock on the client.Called from step_and_send_timestep, which runs on EVERY transition — unlike display_fn,which nicewebrl only calls on episode resets (the per-trial image is swapped client-side).On the OUTCOME screen: ignore manual keys and auto-press 'continue' after a fixed time."""if int(mode) == M_OUTCOME:ui.run_javascript(81 unmodified lineskeyboard to open that chest.- Each **unique chest** brings a certain amount of coins — that's what matters. Watch out:the chests can **swap sides**, so don't click too fast!- The chest **opens and shows** what you and your partner got for a couple of seconds, thenit **closes on its own** and the next try begins — you don't need to press anything.- Each house gives you **20 tries** — choose carefully, and finish all 20 before leavingeach house.- Then you'll **rate which unique chest you preferred**, and head to the next house.471 unmodified lines472473474475476477478479480481118 unmodified lines60060160260360460560660760860961061181 unmodified lines693694695696697698699700471 unmodified linesT(d, W // 2, 8, _earn(s_out, "YOURSELF"), size=18, bold=True, fill=accent, center=True, outline=True)T(d, W // 2, 34, _earn(o_out, "your PARTNER"), size=18, bold=True, fill=accent, center=True, outline=True)# ---- practice: a rotating teaching tip, shown ONLY during the amount-feedback (OUTCOME),# NOT while choosing, in the gap below the table legs (end floor_y+40) and above the# bottom YOU/PARTNER labels (at H-98) ----if practice and mode == M_OUTCOME:tip = PRACTICE_TIPS[trial % len(PRACTICE_TIPS)]T(d, W // 2, floor_y + 62, tip, size=13, bold=True, fill=(255, 120, 120),center=True, outline=True)118 unmodified linesdef _arm_outcome_autoclose(mode):"""Arm (OUTCOME) or cancel (any other screen) the outcome viewing-hold on the client.Called from step_and_send_timestep, which runs on EVERY transition — unlike display_fn,which nicewebrl only calls on episode resets (the per-trial image is swapped client-side).On the OUTCOME screen: lock keys for a minimum viewing time, then show 'Press SPACE' andlet Space advance (it does NOT advance on its own; arrows stay blocked the whole time)."""if int(mode) == M_OUTCOME:ui.run_javascript(81 unmodified lineskeyboard to open that chest.- Each **unique chest** brings a certain amount of coins — that's what matters. Watch out:the chests can **swap sides**, so don't click too fast!- The chest **opens and shows** what you and your partner got. After a couple of seconds a**Press SPACE** prompt appears — press **Space** to close it and start the next try.- Each house gives you **20 tries** — choose carefully, and finish all 20 before leavingeach house.- Then you'll **rate which unique chest you preferred**, and head to the next house.
88 unmodified lines899091929394959697989910010110210310410510610710810911011111211388 unmodified linesdef install_outcome_timer():"""Client-side helpers that auto-close the OUTCOME chest after a fixed time (no Space).Kept here so a break can cancel/restart the countdown without losing the trial."""ui.add_body_html("<script>""window.armOutcomeTimer = function(ms){"" if (window.__autoCont) clearTimeout(window.__autoCont);"" window.__autoCont = setTimeout(async function(){"" if (window.next_states && (' ' in window.next_states)){"" var ns = window.next_states[' ']; window.next_states = null;"" var img = document.getElementById('stateImage'); if (img) img.src = ns;"" window.next_imageSeenTime = new Date();"" await emitEvent('key_pressed', {key:' ', keydownTime:new Date(),"" imageSeenTime: window.imageSeenTime});"" }"" }, ms);""};""window.cancelOutcomeTimer = function(){"" if (window.__autoCont){ clearTimeout(window.__autoCont); window.__autoCont = null; }""};""</script>")88 unmodified lines899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712888 unmodified linesdef install_outcome_timer():"""Client-side helpers for the OUTCOME screen: a minimum viewing time, then a 'Press SPACE'prompt and Space-to-advance (it does NOT advance on its own). During the outcome, all keysbut Space are blocked so an arrow can't reset the timer; Space is blocked until the wait isup. A break can cancel/restart the wait without losing the trial."""ui.add_body_html("<div id='spacePrompt' style='position:fixed; display:none; z-index:45;"" background:rgba(20,20,28,0.74); color:#fff; padding:6px 18px; border-radius:10px;"" font-weight:bold; font-size:18px; pointer-events:none;'>Press SPACE to continue ▸</div>""<script>""window.armOutcomeTimer = function(ms){"" if (window.__outcomeWait) clearTimeout(window.__outcomeWait);"" window.accept_keys = false;" # lock keys during the minimum view" var p = document.getElementById('spacePrompt'); if(p) p.style.display='none';"" window.__outcomeWait = setTimeout(function(){"" window.accept_keys = true;" # now Space advances (arrows blocked)" var p = document.getElementById('spacePrompt');"" var img = document.getElementById('stateImage');"" if(p && img){ var r = img.getBoundingClientRect();"" p.style.left = (r.left + r.width/2) + 'px';"" p.style.top = (r.top + r.height*0.93) + 'px';"" p.style.transform = 'translate(-50%,-50%)'; p.style.display = 'block'; }"" }, ms);""};""window.cancelOutcomeTimer = function(){"" if (window.__outcomeWait){ clearTimeout(window.__outcomeWait); window.__outcomeWait = null; }"" var p = document.getElementById('spacePrompt'); if(p) p.style.display='none';""};"# during the outcome, swallow everything except Space (so an arrow cannot reset the wait)"window.addEventListener('keydown', function(e){"" var isSpace = (e.key === ' ' || e.code === 'Space');"" if (window.__inOutcome && !isSpace){ e.preventDefault(); e.stopImmediatePropagation(); }"" if (window.__inOutcome && isSpace){ var p=document.getElementById('spacePrompt');"" if(p) p.style.display='none'; }""}, true);""</script>")
experiment_structure.py+9-8
web_app.py+27-12