rfaile313 / cavatars-game

A Multiplayer web-browser game based on the "codenames" board game built using NodeJS, Socket.io, and Phaser3
https://rudyfaile.com
8 stars 0 forks source link

[Enhancement] Refactor checkSubmission() in server.js #4

Open rfaile313 opened 3 years ago

rfaile313 commented 3 years ago

While the code in this project isn't super great in general - this mucked up piece of garbage that handles the main server side logic of the game needs a serious refactor:

https://github.com/rfaile313/cavatars-game/blob/a18005f36a22c68039a1c0d69973b234210f7c8f/server/server.js#L271-L380

Some thoughts I have had include compressing it to a switch statement or assigning local variables which get passed dynamically to the different if cases.

I'll probably get around to it eventually but anyone should feel welcome to take a stab if they see this.