reference-game: disjoint layouts and role-keyed feedback - #80
Open
Mandyx22 wants to merge 1 commit into
Open
Conversation
Two options the original tangrams experiment (hawkrobe/tangrams, OSF osf.io/vzvmf)
needs and the plugin could not express:
- scramble_mode: "disjoint". Like "independent", but no object may occupy the same
slot for both players -- a derangement between the two layouts. "independent"
only guarantees the layouts are not identical, so ~1/e of objects still coincide
by chance and positional reference sometimes works by luck. The original re-rolls
until every position differs (game.core.js notMatchingLocs/arraysDifferent).
Implemented as bounded rejection sampling over the existing deterministic salts,
backstopped by a rotation of the other player's order, which cannot have a fixed
point -- so it stays deterministic and both clients still derive the same pair.
- feedback_content may be keyed by role: { director: {...}, matcher: {...} }. The
original shows each role exactly one thing -- the director sees the object the
matcher clicked, the matcher sees the true target. Detected by the presence of a
director/matcher key, so a flat object behaves exactly as before, and omitted
keys fall back to the per-key defaults.
12 new tests: disjointness across 60 rounds and three id pairs, cross-client
agreement and argument-order independence, permutation integrity, the N=2 and N=1
edge cases, a check that plain "independent" really does produce coincidences, and
the four role-keyed feedback paths. Suite: 61 passing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two options to
plugin-multiplayer-reference-game. Both come from auditing a replication against the original tangrams experiment (hawkrobe/tangrams, OSF osf.io/vzvmf) and finding behaviour the plugin could not express. Neither is specific to that paper.scramble_mode: "disjoint"Like
"independent", but no object may occupy the same slot for both players — a derangement between the two layouts."independent"only guarantees the two layouts are not identical. A random permutation pair still shares about 1/e of its positions, so in a 12-object grid roughly four tangrams sit in the same cell for both players on a typical trial, and "the one in the bottom left corner" works by luck often enough to matter. That undercuts the whole point of scrambling. The original re-rolls until every position differs (game.core.js,notMatchingLocs/arraysDifferent).Implemented as bounded rejection sampling over the existing deterministic salts — a random pair is disjoint ~37% of the time, so it normally lands within a few tries — backstopped by a rotation of the other player's order, which cannot have a fixed point. It stays deterministic, so both clients still derive the same pair with no extra network traffic, and
partner_orderstill lands in the data without a push. Disjointness is impossible for a single object, so it is skipped there.Role-keyed
feedback_contentfeedback_contentmay now be given per role:The original shows each role exactly one thing — the director sees which object the matcher clicked, the matcher sees the intended target — where the plugin showed both players everything. Detected by the presence of a
director/matcherkey, so a flat object behaves exactly as before and omitted keys fall back to the per-key defaults.Compatibility
Both are opt-in; no existing behaviour changes.
"independent"still means what it meant, which matters for experiments already configured against it — a named scramble mode that quietly changes geometry between versions would make two runs of the same experiment file incomparable.Testing
12 new tests, 61 passing in the package. Disjointness across 60 rounds × 3 participant-id pairs; cross-client agreement and argument-order independence; permutation integrity; the N=2 and N=1 edge cases; an explicit check that plain
"independent"really does produce coincidences, so the new mode is not a no-op; and the four role-keyed feedback paths, including the flat-object fallback.Full monorepo suite: 544 passing, 25 suites.
adapter-multiplayer-firebasefails to run on a missingfirebase/appmodule — pre-existing, identical onmain(532 passing there; the 12 new tests are the difference).README and a changeset are included.
Related
jspsych/multiplayer-test-experiments#19 uses both options and is blocked on this — that build cannot run until this merges and the package publishes.
🤖 Generated with Claude Code