-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulateMatch.js
More file actions
81 lines (65 loc) · 2.89 KB
/
Copy pathsimulateMatch.js
File metadata and controls
81 lines (65 loc) · 2.89 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* World of Agents - Phase 3
* Multi-lane MOBA simulation with towers and strongholds
*/
import { createAgent } from "./Agent.js";
import { createGameState, addHeroToGame, moveHeroToLane, printGameStatus } from "./GameState.js";
import { processTick } from "./CombatEngine.js";
import { checkVictory } from "./Stronghold.js";
// Create game state
const gameState = createGameState();
// Create heroes for Alliance
const warrior = createAgent("Theron the Ironclad", "WARRIOR");
const mage = createAgent("Seraphina the Arcane", "MAGE");
// Create heroes for Horde
const ranger = createAgent("Grommak the Hunter", "RANGER");
const healer = createAgent("Zul'jin the Wise", "HEALER");
// Add heroes to game
addHeroToGame(gameState, warrior, "alliance", "top");
addHeroToGame(gameState, mage, "alliance", "mid");
addHeroToGame(gameState, ranger, "horde", "mid");
addHeroToGame(gameState, healer, "horde", "bot");
console.log("\n╔════════════════════════════════════════════════════════════╗");
console.log("║ WORLD OF AGENTS - MULTI-LANE SIMULATION ║");
console.log("╚════════════════════════════════════════════════════════════╝");
// Initial state
printGameStatus(gameState);
// Simulation settings
const MAX_TICKS = 100;
const PRINT_INTERVAL = 20;
console.log(`\nSimulating ${MAX_TICKS} ticks...\n`);
// Main game loop
while (gameState.tick < MAX_TICKS && !gameState.winner) {
processTick(gameState);
// Periodically print status
if (gameState.tick % PRINT_INTERVAL === 0) {
printGameStatus(gameState);
}
// Simple AI: randomly move heroes occasionally
if (gameState.tick % 15 === 0) {
const lanes = ["top", "mid", "bot"];
// Move warrior to a random lane
const randomLane = lanes[Math.floor(Math.random() * lanes.length)];
if (warrior.hp > 0 && warrior.lane !== randomLane) {
moveHeroToLane(gameState, warrior, randomLane);
console.log(` >> ${warrior.name} rotates to ${randomLane.toUpperCase()}`);
}
// Move ranger to contest warrior
if (ranger.hp > 0 && ranger.lane !== warrior.lane) {
moveHeroToLane(gameState, ranger, warrior.lane);
console.log(` >> ${ranger.name} rotates to ${warrior.lane.toUpperCase()} to contest`);
}
}
}
// Final state
console.log("\n" + "=".repeat(60));
console.log("FINAL GAME STATE");
printGameStatus(gameState);
// Print event log summary
console.log("\nKEY EVENTS:");
const importantEvents = gameState.events.filter(e =>
["hero_joined", "tower_destroyed", "hero_kill", "hero_respawn", "game_over"].includes(e.type)
);
for (const event of importantEvents.slice(-20)) {
console.log(` [Tick ${event.tick}] ${event.type}: ${JSON.stringify(event)}`);
}