JoeBussard / polywordleapi

the api for playing polywordle
0 stars 0 forks source link

Making a custom game with non-dictionary solution is handled improperly #71

Open JoeBussard opened 1 year ago

JoeBussard commented 1 year ago

The current ruleset states that custom games must have a solution that is in the all-words dictionary.

Currently, if a client requests a game with an improper solution, the server creates a new game state, then realizes the word is not in all-words, then returns a 404 response. This means memory is being tied up to store a game state which is inaccessible.

Need to fix the way custom games are created so that game state is only created and stored in memory for games that are guaranteed to be valid when the process completes. Game states should not be created if the state is going to be unusable any ways.

Second, the game not being in the dictionary is a game rules violation. Violations of game rules should be handled with a 200 request that contains an error field in the JSON request. Only technical errors should use response codes other than 200.