Visualizes coalition formation in a 3-player transferable-utility cooperative game. The animation cycles through all player orderings (permutations). As each player joins the current coalition S, the canvas shows v(S), v(S∪{i}), and the marginal contribution v(S∪{i})−v(S). On the right, each player’s Shapley value φ_i is shown as the average marginal contribution over orderings (exact, plus a running sample average that repeatedly converges).
Uses a fixed 3-player characteristic function v(S)=sum of singleton values + pair synergies + triple synergy (bitmask representation). Cycles through the 6 permutations; within each permutation, joining is eased and shown step-by-step. Exact Shapley values are precomputed by averaging marginal contributions over all permutations; a running average is updated once per permutation to visualize the expectation idea. Grid-snapped rectangles and monospace text create a blocky green-on-black aesthetic; layout scales with canvas size via scale=min(w,h)/240.