Spaces:
Sleeping
Sleeping
| <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> |