Merge branch 'Properties' of MEDLab/MonopolyLedger into main
This commit is contained in:
@@ -6,13 +6,27 @@
|
|||||||
<body>
|
<body>
|
||||||
<h1>Monopoly Ledger</h1>
|
<h1>Monopoly Ledger</h1>
|
||||||
|
|
||||||
<div id="output"></div>
|
<div id="setup">
|
||||||
|
<h2>Setup</h2>
|
||||||
|
<label for="numPlayers">Number of Players:</label>
|
||||||
|
<input type="number" id="numPlayers">
|
||||||
|
<br>
|
||||||
|
<label for="startingValue">Starting Value:</label>
|
||||||
|
<input type="number" id="startingValue">
|
||||||
|
<br>
|
||||||
|
<button onclick="initialize()">Set</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="balances">
|
||||||
|
<h2>Balances</h2>
|
||||||
|
<div id="output"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="transactions">
|
<div id="transactions">
|
||||||
|
|
||||||
<h2>Transactions</h2>
|
<h2>Transactions</h2>
|
||||||
|
|
||||||
<form id="form" onsubmit="event.preventDefault();">
|
<form id="transactions" onsubmit="event.preventDefault();">
|
||||||
<label for="fromAcc">From:</label>
|
<label for="fromAcc">From:</label>
|
||||||
<select id="fromAcc">
|
<select id="fromAcc">
|
||||||
<option value="pot">Pot</option>
|
<option value="pot">Pot</option>
|
||||||
@@ -36,10 +50,69 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Add property list -->
|
||||||
|
<div id="propertyList">
|
||||||
|
<h2>Properties</h2>
|
||||||
|
<ul id="propertyItems"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var numPlayers = 0;
|
var numPlayers = 0;
|
||||||
var accounts = [];
|
var accounts = [];
|
||||||
|
|
||||||
|
// Property list data
|
||||||
|
var properties = [
|
||||||
|
// Brown Properties
|
||||||
|
{ name: "Mediterranean Avenue", owner: "none", improvements: false, price: 60 },
|
||||||
|
{ name: "Baltic Avenue", owner: "none", improvements: false, price: 60 },
|
||||||
|
|
||||||
|
// Light Blue Properties
|
||||||
|
{ name: "Oriental Avenue", owner: "none", improvements: false, price: 100 },
|
||||||
|
{ name: "Vermont Avenue", owner: "none", improvements: false, price: 100 },
|
||||||
|
{ name: "Connecticut Avenue", owner: "none", improvements: false, price: 120 },
|
||||||
|
|
||||||
|
// Pink Properties
|
||||||
|
{ name: "St. Charles Place", owner: "none", improvements: false, price: 140 },
|
||||||
|
{ name: "States Avenue", owner: "none", improvements: false, price: 140 },
|
||||||
|
{ name: "Virginia Avenue", owner: "none", improvements: false, price: 160 },
|
||||||
|
|
||||||
|
// Orange Properties
|
||||||
|
{ name: "St. James Place", owner: "none", improvements: false, price: 180 },
|
||||||
|
{ name: "Tennessee Avenue", owner: "none", improvements: false, price: 180 },
|
||||||
|
{ name: "New York Avenue", owner: "none", improvements: false, price: 200 },
|
||||||
|
|
||||||
|
// Red Properties
|
||||||
|
{ name: "Kentucky Avenue", owner: "none", improvements: false, price: 220 },
|
||||||
|
{ name: "Indiana Avenue", owner: "none", improvements: false, price: 220 },
|
||||||
|
{ name: "Illinois Avenue", owner: "none", improvements: false, price: 240 },
|
||||||
|
|
||||||
|
// Yellow Properties
|
||||||
|
{ name: "Atlantic Avenue", owner: "none", improvements: false, price: 260 },
|
||||||
|
{ name: "Ventnor Avenue", owner: "none", improvements: false, price: 260 },
|
||||||
|
{ name: "Marvin Gardens", owner: "none", improvements: false, price: 280 },
|
||||||
|
|
||||||
|
// Green Properties
|
||||||
|
{ name: "Pacific Avenue", owner: "none", improvements: false, price: 300 },
|
||||||
|
{ name: "North Carolina Avenue", owner: "none", improvements: false, price: 300 },
|
||||||
|
{ name: "Pennsylvania Avenue", owner: "none", improvements: false, price: 320 },
|
||||||
|
|
||||||
|
// Dark Blue Properties
|
||||||
|
{ name: "Park Place", owner: "none", improvements: false, price: 350 },
|
||||||
|
{ name: "Boardwalk", owner: "none", improvements: false, price: 400 },
|
||||||
|
|
||||||
|
// Railroads
|
||||||
|
{ name: "Reading Railroad", owner: "none", improvements: false, price: 200 },
|
||||||
|
{ name: "Pennsylvania Railroad", owner: "none", improvements: false, price: 200 },
|
||||||
|
{ name: "B. & O. Railroad", owner: "none", improvements: false, price: 200 },
|
||||||
|
{ name: "Short Line Railroad", owner: "none", improvements: false, price: 200 },
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
{ name: "Electric Company", owner: "none", improvements: false, price: 150 },
|
||||||
|
{ name: "Water Works", owner: "none", improvements: false, price: 150 }
|
||||||
|
// Add more properties as needed
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
function printBalances() {
|
function printBalances() {
|
||||||
var output = document.getElementById("output");
|
var output = document.getElementById("output");
|
||||||
output.innerHTML = "";
|
output.innerHTML = "";
|
||||||
@@ -49,21 +122,42 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
numPlayers = parseInt(prompt("How many players (>1)?"));
|
var numPlayersInput = document.getElementById("numPlayers");
|
||||||
if (numPlayers < 2) {
|
var startingValueInput = document.getElementById("startingValue");
|
||||||
initialize();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var startingValue = parseInt(prompt("How much for each player?"));
|
|
||||||
accounts.push(["Pot", 0]);
|
|
||||||
for (var i = 1; i <= numPlayers; i++) {
|
|
||||||
accounts.push(["Player " + i, startingValue]);
|
|
||||||
}
|
|
||||||
console.log("Created:");
|
|
||||||
printBalances();
|
|
||||||
console.log("Let the game begin!");
|
|
||||||
|
|
||||||
generatePlayerOptions();
|
numPlayers = parseInt(numPlayersInput.value);
|
||||||
|
var startingValue = parseInt(startingValueInput.value);
|
||||||
|
|
||||||
|
if (numPlayers < 2 || isNaN(numPlayers) || isNaN(startingValue)) {
|
||||||
|
alert("Invalid input. Please enter a valid number of players and starting value.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
accounts = [];
|
||||||
|
var initialProperties = [...properties]; // Copy the initial properties
|
||||||
|
|
||||||
|
accounts.push(["Pot", 0]);
|
||||||
|
for (var i = 1; i <= numPlayers; i++) {
|
||||||
|
accounts.push(["Player " + i, startingValue]);
|
||||||
|
}
|
||||||
|
|
||||||
|
properties = [...initialProperties]; // Restore the initial properties
|
||||||
|
|
||||||
|
resetPropertyOwners();
|
||||||
|
generatePropertyList();
|
||||||
|
|
||||||
|
printBalances();
|
||||||
|
generatePlayerOptions();
|
||||||
|
|
||||||
|
numPlayersInput.value = "";
|
||||||
|
startingValueInput.value = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPropertyOwners() {
|
||||||
|
// Reset property owners to "none"
|
||||||
|
for (var i = 0; i < properties.length; i++) {
|
||||||
|
properties[i].owner = "none";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generatePlayerOptions() {
|
function generatePlayerOptions() {
|
||||||
@@ -103,6 +197,42 @@
|
|||||||
toAccSelect.add(allOption.cloneNode(true));
|
toAccSelect.add(allOption.cloneNode(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generatePropertyList() {
|
||||||
|
var propertyItems = document.getElementById("propertyItems");
|
||||||
|
propertyItems.innerHTML = ""; // Clear existing property list
|
||||||
|
|
||||||
|
properties.forEach(function(property) {
|
||||||
|
var listItem = document.createElement("li");
|
||||||
|
listItem.innerHTML = `
|
||||||
|
${property.name}
|
||||||
|
<select class="ownershipDropdown" onchange="updateOwnership(this.value, '${property.name}')">
|
||||||
|
<option value="none">None</option>
|
||||||
|
${generatePlayerOptionsHTML()}
|
||||||
|
</select>
|
||||||
|
`;
|
||||||
|
propertyItems.appendChild(listItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function generatePlayerOptionsHTML() {
|
||||||
|
var optionsHTML = "";
|
||||||
|
|
||||||
|
for (var i = 1; i <= numPlayers; i++) {
|
||||||
|
optionsHTML += `<option value="Player ${i}">Player ${i}</option>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return optionsHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateOwnership(player, propertyName) {
|
||||||
|
properties.forEach(function(property) {
|
||||||
|
if (property.name === propertyName) {
|
||||||
|
property.owner = player;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function sendMoney() {
|
function sendMoney() {
|
||||||
var fromAcc = document.getElementById("fromAcc").value;
|
var fromAcc = document.getElementById("fromAcc").value;
|
||||||
var toAcc = document.getElementById("toAcc").value;
|
var toAcc = document.getElementById("toAcc").value;
|
||||||
@@ -142,8 +272,6 @@
|
|||||||
printBalances();
|
printBalances();
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize();
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@@ -42,10 +42,7 @@ The following are example rule changes that can be tried up against the standard
|
|||||||
## To do
|
## To do
|
||||||
|
|
||||||
* Do a game jam on alternative Monopoly rules, designing and testing them.
|
* Do a game jam on alternative Monopoly rules, designing and testing them.
|
||||||
* Setup mode vs play mode? Can change rules midway, but not initial allocations.
|
|
||||||
* Use movable boxes dashboard js thing to allow moving
|
* Use movable boxes dashboard js thing to allow moving
|
||||||
* Assets tool
|
|
||||||
* Add properties, improvements
|
|
||||||
* Rules tool
|
* Rules tool
|
||||||
* Enable initial and dynamic additions of rules atop standard rules
|
* Enable initial and dynamic additions of rules atop standard rules
|
||||||
* Enable voting on rule changes: 1p1v, quadratic
|
* Enable voting on rule changes: 1p1v, quadratic
|
||||||
|
Reference in New Issue
Block a user