I'm working on building a simple projectgame in vanilla js (tic-tac-toe). ISome weeks ago created a functional MVP and asked some questions about it (Vanilla JS Tic-Tac-Toe). The code worked, but it was a single monolithic mess and the ui was ugly, so I decided to improve it.
So, I organized the refactored the code. I organized it in three files:
How to implement a MVC pattern with this code? Right now the state and html elements are global variables, but I think this could be stored in the state and UI clases. Also, I'm having troubles with the concept of controller. Are main.js the code that corresponds towill be the controller in an MVC pattern? TLDR: how to transform this code to MVC?
There's a better wayalgorithm to check for the winner?
Is it a good looking code? How it could will be improved? What looks ugly and could be done in a better way? I really would like to develop good practices from the beginning.
My goals with this areSome features that i would like to implement are a CPU player, storestoring the score in localStorage, remember the player name, auth, two-player network gamming, etc. I'm in the correct way of doing things?