Skip to content

Commit efe513f

Browse files
committed
modify move distance
1 parent 4ff2e5c commit efe513f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

simulator/app.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@ for (let i = 0; i < MAX_PLAYERS / 2; i++) {
3232
addPlayer();
3333
}
3434

35+
const interval = process.env.INTERVAL || "*/2 * * * * *";
36+
3537
schedule(
36-
"*/2 * * * * *",
38+
interval,
3739
() => {
3840
if (players.size > 0 && Math.random() < 0.5) {
3941
removePlayer();
4042
}
4143

4244
players.forEach((pos, key) => {
43-
const dx = Math.floor(Math.random() * 4 - 2);
44-
const dz = Math.floor(Math.random() * 4 - 2);
45+
if (Math.random() > 0.2) return;
46+
47+
const dx = Math.floor(Math.random() * 24 - 12);
48+
const dz = Math.floor(Math.random() * 24 - 12);
4549
players.set(key, { ...pos, x: pos.x + dx, z: pos.z + dz });
4650
});
4751

0 commit comments

Comments
 (0)