Infinite-Chess / infinitechess.org

Infinite Chess Web Server
https://www.infinitechess.org
GNU Affero General Public License v3.0
173 stars 39 forks source link

Game code is circular dependant. #83

Open Naviary2 opened 2 months ago

Naviary2 commented 2 months ago

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

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!

Heinrich-XIAO commented 2 months ago

This sounds like an enhancement for making unit tests.

Naviary2 commented 1 month ago

dependancyGraph

I'm sharing this dependancy graph generated by Idonotus. The red scripts are all circular dependant.

222 Would work on converting each game script into an ESM, to help us make them more modular, and allow use of the same scripts on both the server and client-side.