Two-Player Shapley Value Calculator
The two-player Shapley value calculator divides the value of cooperation using each player's contribution across both possible joining orders.
Run — free
Enter what player one can produce alone, what player two can produce alone, and what they create together. The result gives each player's Shapley allocation, the cooperation surplus or shortfall, and the grand coalition value used for the calculation. It is useful for transparent revenue sharing, cost allocation, partnership analysis, bargaining preparation, and cooperative game theory exercises.
Define the three coalition values consistently
A two-player cooperative game needs three supplied values because the empty coalition is normalized to zero. Enter player one value as the amount player one can create without player two, and enter player two value on the same basis. Then enter the grand coalition value, which is the value created when both participate. All three figures must describe the same outcome, currency, time period, and accounting boundary. For example, do not compare one player's monthly profit with the partnership's annual revenue, or use gross sales for the singleton values and net profit for the joint value. Values may be positive, zero, or negative, so the calculator can represent benefits, costs, losses, or obligations as long as their signs are interpreted consistently. The tool assumes the empty coalition has value zero and that the entire grand coalition value will be allocated between the two players. It does not estimate coalition values from contracts, forecasts, market data, effort, ownership percentages, or bargaining power; those values are inputs supplied by the analyst.
How the two-player Shapley allocation is calculated
The Shapley method asks how much each player adds when participants join the coalition in every possible order, then averages those marginal contributions. With two players there are only two orders. If player one arrives first, player one's contribution is the singleton value v({1}); if player one arrives second, the contribution is the grand coalition value v({1,2}) minus player two's singleton value v({2}). Averaging those two contributions gives player one's Shapley value. Player two is calculated symmetrically. An equivalent shortcut starts with each player's singleton value, computes the cooperation surplus as v({1,2}) - v({1}) - v({2}), and assigns half of that surplus to each player. The two returned allocations therefore add exactly to the grand coalition value before display normalization. If cooperation produces a shortfall instead of a surplus, the same rule divides that negative amount equally. This is not an arbitrary fifty-fifty division of total value: unequal standalone values remain intact, while only the incremental gain or loss from cooperation is shared equally.
Interpret the result and decide whether the model fits
Use each Shapley value as a principled allocation benchmark, not as an automatic legal entitlement or a complete negotiation outcome. The method satisfies efficiency because the allocations exhaust the grand coalition value, and it treats players symmetrically when their coalition contributions are identical. It also recognizes standalone capability: a player who can create more value alone generally receives more, even though the cooperation surplus is split equally in a two-player game. A positive surplus means joint production exceeds the sum of separate production; a negative surplus means the stated joint outcome underperforms that sum, so both allocations absorb half of the shortfall. Before adopting the result, check whether value is transferable between players and whether the three coalition values capture all relevant effects. Contracts may require minimum payments, ownership rights, risk adjustments, taxes, outside options, or constraints that the basic game omits. The calculator also covers exactly two players; games with three or more participants require values for additional coalitions and different combinatorial weights. Document the inputs and assumptions beside the allocation so reviewers can distinguish arithmetic fairness from judgment used to value each coalition.
What you can do with it
Allocate partnership revenue
Split a joint project's value while preserving what each partner could have generated independently.
Share cooperative savings
Divide the incremental savings from a two-party procurement, logistics, or infrastructure arrangement.
Verify a game theory exercise
Check both player allocations, the cooperation surplus, and the efficiency of a two-player solution.
FAQ
What formula does the calculator use?
Player one's allocation is [v({1}) + v({1,2}) - v({2})] / 2, and player two's allocation is [v({2}) + v({1,2}) - v({1})] / 2.
Why is the cooperation surplus split equally?
Across the two possible joining orders, each player is first once and second once. Averaging marginal contributions assigns each half of the incremental cooperation value.
Can the cooperation surplus be negative?
Yes. A negative result means the grand coalition is worth less than the two singleton values combined, and the Shapley rule shares that shortfall equally.
Do the two allocations add to the grand coalition value?
Yes. The two-player Shapley allocation is efficient, so the returned player values exhaust the stated grand coalition value.
Does this calculator support more than two players?
No. A larger game needs values for more coalitions and averages marginal contributions over additional joining orders.
What does an API calculation cost?
Each API request costs $0.002. The same deterministic calculation can run free in your browser.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/econ/shapley-value-two-player \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"grand_coalition_value":140,"player_one_value":40,"player_two_value":60}'const res = await fetch("https://api.kit.forhosting.com/econ/shapley-value-two-player", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"grand_coalition_value": 140,
"player_one_value": 40,
"player_two_value": 60
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/econ/shapley-value-two-player",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"grand_coalition_value": 140,
"player_one_value": 40,
"player_two_value": 60
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/econ/shapley-value-two-player", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"grand_coalition_value":140,"player_one_value":40,"player_two_value":60}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"grand_coalition_value":140,"player_one_value":40,"player_two_value":60}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/econ/shapley-value-two-player", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"grand_coalition_value": 140,
"player_one_value": 40,
"player_two_value": 60
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "econ.shapley_value_two_player",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |