File size: 708 Bytes
1aa2774
 
5cbcb7d
1aa2774
 
 
 
 
 
 
 
5cbcb7d
 
1aa2774
5cbcb7d
1aa2774
 
 
 
5cbcb7d
1aa2774
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<hr>
<h3>World Simulator</h3>

<button onclick="initWorld()">Init World (50 Agents)</button>
<button onclick="stepWorld()">Step World</button>

<pre id="world"></pre>

<script>
async function initWorld() {
  const res = await fetch("/world/init", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ agents: 50 })
  });
  const data = await res.json();
  document.getElementById("world").textContent =
    JSON.stringify(data, null, 2);
}

async function stepWorld() {
  const res = await fetch("/world/step", { method: "POST" });
  const data = await res.json();
  document.getElementById("world").textContent =
    JSON.stringify(data, null, 2);
}
</script>