diff --git a/_static/accept.js b/_static/accept.js index ea921ff..2e0c83c 100644 --- a/_static/accept.js +++ b/_static/accept.js @@ -1,4 +1,5 @@ let numPlayers = 3; +let player_names = js_vars.player_names; let pastOffersTable = document.getElementById('past-offers-table'); @@ -12,7 +13,7 @@ function populatePastOffers(pastOffers) { let from = row.insertCell(); from.className = "offer-proposer-col"; - from.innerHTML = `P${offer.player}`; + from.innerHTML = player_names[`P${offer.player}`]; for (let i = 0; i < numPlayers; i++) { let cell = row.insertCell(); diff --git a/_static/coalitions_demo.js b/_static/coalitions_demo.js index 760f271..42253bb 100644 --- a/_static/coalitions_demo.js +++ b/_static/coalitions_demo.js @@ -1,5 +1,7 @@ let numPlayers = 3; +let player_names = js_vars.player_names; + let totalShareable = document.getElementById('total-shareable'); let totalShared = document.getElementById('total-shared'); @@ -101,7 +103,7 @@ function updatePastOffers(newPastOffers) { let from = row.insertCell(); from.className = "offer-proposer-col"; - from.innerHTML = `P${offer.player}`; + from.innerHTML = player_names[`P${offer.player}`]; for (let i = 0; i < numPlayers; i++) { let cell = row.insertCell(); diff --git a/_static/live_bargaining.css b/_static/live_bargaining.css index f4d8eb2..6b752be 100644 --- a/_static/live_bargaining.css +++ b/_static/live_bargaining.css @@ -118,7 +118,7 @@ table.shaded-rows tbody tr:nth-child(odd) { } .otree-chat__nickname { - width: 120px; + width: 70px; } #payoff-table { diff --git a/_static/live_bargaining.js b/_static/live_bargaining.js index be60151..b72bf68 100644 --- a/_static/live_bargaining.js +++ b/_static/live_bargaining.js @@ -21,6 +21,7 @@ let pastOffers = [] let prod_fct = js_vars.prod_fct; let prod_fct_labels = js_vars.prod_fct_labels; let lastPlayerIsDummy = prod_fct.length == numPlayers - 1; +let player_names = js_vars.player_names; let popupFull = document.getElementById('popup-full'); let popupTitle = document.getElementById('popup-title'); @@ -67,8 +68,12 @@ for (let i = 0; i < numPlayers; i++) { } function sendOffer() { - if (totalSharedValue > 0 && !isMemberCheckboxes[0].checked) { - openPopup('Invalid proposal: the budget is zero when Player 1 is not included in the group', 'error'); + if (!lastPlayerIsDummy && totalSharedValue > 0 && !isMemberCheckboxes[0].checked) { + openPopup(`Invalid proposal: the budget is zero when Player ${player_names['P1']} is not included in the group`, 'error'); + return; + } + if (lastPlayerIsDummy && totalSharedValue > 0 && !(isMemberCheckboxes[0].checked && isMemberCheckboxes[1].checked)) { + openPopup(`Invalid proposal: the budget is zero when Players ${player_names['P1']} and ${player_names['P2']} are not included in the group`, 'error'); return; } if (totalSharedValue > totalShareableValue) { @@ -184,7 +189,7 @@ function updatePastOffers(newPastOffers) { let from = row.insertCell(); from.className = "offer-proposer-col"; - from.innerHTML = `P${offer.player}`; + from.innerHTML = player_names[`P${offer.player}`]; for (let i = 0; i < numPlayers; i++) { let cell = row.insertCell(); diff --git a/_static/proposal_demo.js b/_static/proposal_demo.js index 2e08f09..8d98390 100644 --- a/_static/proposal_demo.js +++ b/_static/proposal_demo.js @@ -19,6 +19,7 @@ let pastOffers = [] let prod_fct = js_vars.prod_fct; let prod_fct_labels = js_vars.prod_fct_labels; let lastPlayerIsDummy = prod_fct.length == numPlayers - 1; +let player_names = js_vars.player_names; let popupFull = document.getElementById('popup-full'); let popupTitle = document.getElementById('popup-title'); @@ -90,8 +91,12 @@ function sendOffer() { 'allocations': allocations, }; - if (totalSharedValue > 0 && !members[0]) { - openPopup('Invalid proposal: the budget is zero when Player 1 is not included in the group', 'error'); + if (!lastPlayerIsDummy && totalSharedValue > 0 && !isMemberCheckboxes[0].checked) { + openPopup(`Invalid proposal: the budget is zero when Player ${player_names['P1']} is not included in the group`, 'error'); + return; + } + if (lastPlayerIsDummy && totalSharedValue > 0 && !(isMemberCheckboxes[0].checked && isMemberCheckboxes[1].checked)) { + openPopup(`Invalid proposal: the budget is zero when Players ${player_names['P1']} and ${player_names['P2']} are not included in the group`, 'error'); return; } if (totalSharedValue > totalShareableValue) { @@ -151,7 +156,7 @@ function updatePastOffers(newPastOffers) { let from = row.insertCell(); from.className = "offer-proposer-col"; - from.innerHTML = `P${offer.player}`; + from.innerHTML = player_names[`P${offer.player}`]; for (let i = 0; i < numPlayers; i++) { let cell = row.insertCell(); diff --git a/introduction/Coalitions.html b/introduction/Coalitions.html index 7a80213..d57fa7b 100644 --- a/introduction/Coalitions.html +++ b/introduction/Coalitions.html @@ -28,7 +28,7 @@
Note that because Player 1 has to be included for a group to receive a budget, there will be one group at most.
+Note that because Player {{P1}} has to be included for a group to receive a budget, there will be one group at most.
- You and the two other players will each be randomly assigned a player number ("Player 1/2/3"). - The player numbers will be reshuffled each round. + You and the two other players will each be randomly assigned a player role ({{P1}}, {{P2}}, {{P3}}). + The player roles will be reshuffled each round.
- A group needs to include Player 1 to receive any budget. + A group needs to include Player {{P1}} to receive any budget. The more members a group has, the bigger the budget. For the exact size of the budget in CHF, you will see a table and a corresponding graph like the one below ("Group budgets").
-
For example, if Player 1 and one other player form a group together, they have a budget of 50 CHF. If all players form a group together, they have a budget of 100 CHF. (The exact numbers might be different in the game.)
+For example, if Player {{P1}} and one other player form a group together, they have a budget of 50 CHF. If all players form a group together, they have a budget of 100 CHF. (The exact numbers might be different in the game.)
@@ -113,9 +113,9 @@In this round, unlike in previous rounds, adding Player 5 has no impact on the budget.
{{ endif }} -In this round you are Player {{ player.id_in_group }}.
+In this round you are Player {{ player_name }}.
Remember, payoffs are determined as follows: