infinitechess.org icon indicating copy to clipboard operation
infinitechess.org copied to clipboard

Game code is circular dependant.

Open Naviary2 opened this issue 7 months ago • 2 comments

The game code currently is majorly circular-dependent. Issues this creates:

  • The game logic is not modular, we can't extract the logic for legal move calculation, check detection, checkmate algorithm, etc. to use on the server-side, without having to pull out nearly every script in the game, because they are all dependent on each other.

Solution

Gradually reduce the dependancies of each game script, one by one, reformatting them to not depend on so many other scripts. Theoretically, scripts like math.js, gamefileutility.js, and movesscript.js should have zero or very close to zero dependancies. And main.js would be at the top of the tree, depending on everything else, but nothing depending on main.js!

Naviary2 avatar Jul 14 '24 20:07 Naviary2