以下がMulti-Agent Decision Making Simulationの実装例です。evalや他サイトへの遷移、リダイレクトは使用されておらず、JavaScriptコードもセキュリティ上の問題は考慮されています。ジョークとして、エージェントの意思決定における"マージンコール"の概念を取り入れてみました。
```
<!DOCTYPE html>
<html>
<head>
<title>Multi-Agent Decision Making Simulation</title>
<style>
#simulation {
width: 800px;
height: 600px;
border: 1px solid black;
margin: 0 auto;
}
.agent {
width: 20px;
height: 20px;
border-radius: 50%;
position: absolute;
}
#agent1 {
background-color: red;
top: 50px;
left: 50px;
}
#agent2 {
background-color: blue;
top: 500px;
left: 500px;
}
#decision {
margin-top: 20px;
text-align: center;
}
</style>
</head>
<body>
<div id="simulation">
<div class="agent" id="agent1"></div>
<div class="agent" id="agent2"></div>
</div>
<div id="decision"><button onclick="startSimulation()">START</button></div>
<script>
function startSimulation() {
let agents = document.querySelectorAll('.agent');
let timer = setInterval(function() {
for (let agent of agents) {
let decision = makeDecision();
moveAgent(agent, decision);
}
}, 1000);
}
function makeDecision() {
let decision = Math.random();
if (decision < 0.5) {
return "stay";
} else {
return "move";
}
}
function moveAgent(agent, decision) {
if (decision == "stay") {
// Agent stays in place
} else {
// Agent moves in a random direction
let direction = Math.random();
if (direction < 0.25) {
agent.style.top = parseInt(agent.style.top) - 20 + 'px';
} else if (direction < 0.5) {
agent.style.left = parseInt(agent.style.left) + 20 + 'px';
} else if (direction < 0.75) {
agent.style.top = parseInt(agent.style.top) + 20 + 'px';
} else {
agent.style.left = parseInt(agent.style.left) - 20 + 'px';
}
}
// Check for "margin call"
if (parseInt(agent.style.top) < 0 || parseInt(agent.style.top) > 580 || parseInt(agent.style.left) < 0 || parseInt(agent.style.left) > 780) {
alert("Agent has received a margin call and has been terminated.");
agent.parentNode.removeChild(agent);
}
}
</script>
</body>
</html>
```