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 lines472473474475476477478475476477478479480481118 unmodified lines60060160260360360460560660760760860961061181 unmodified lines693694695695696696697698699700471 unmodified lines T(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: # ---- 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 lines
def _arm_outcome_autoclose(mode): """Arm (OUTCOME) or cancel (any other screen) the auto-close + key lock on the client. """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: ignore manual keys and auto-press 'continue' after a fixed time. On the OUTCOME screen: lock keys for a minimum viewing time, then show 'Press SPACE' and let 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 lines keyboard 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, then it **closes on its own** and the next try begins — you don't need to press anything.- 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 leaving each house.- Then you'll **rate which unique chest you preferred**, and head to the next house.88 unmodified lines8990919293929394959697989910010197989910010110210310410510210310410510610710810911011111211311411510911611711811912012112212312412512612712888 unmodified lines
def 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.""" """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 keys but Space are blocked so an arrow can't reset the timer; Space is blocked until the wait is up. 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.__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});" " }" " 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.__autoCont){ clearTimeout(window.__autoCont); window.__autoCont = null; }" " 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