infinitechess.org
infinitechess.org copied to clipboard
Game code is circular dependant.
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
!