refactor: Resolve import and constant duplication issues in AI and game modules

This commit is contained in:
Kacper Kostka (aider)
2025-04-02 11:50:23 +02:00
parent be20e824f3
commit 8057ba881b
2 changed files with 13 additions and 23 deletions

10
game.js
View File

@@ -1,6 +1,8 @@
/**********************************************************************
* GAME CORE
**********************************************************************/
// Import AI functions
import { updateCitizen, updateAnimal } from './ai.js';
let frameCount = 0;
let money = 5000; // Start with 5000
let purchaseMode = null;
@@ -122,7 +124,13 @@ function update() {
frameCount++;
// Citizens
citizens.forEach((cit) => updateCitizen(cit));
citizens.forEach((cit) => {
if(typeof updateCitizen === 'function') {
updateCitizen(cit);
} else {
console.error("updateCitizen function is not defined!");
}
});
// Animals
animals.forEach((ani) => {