diff --git a/src/utils/Game.ts b/src/utils/Game.ts index 83e0f8d..6ca9fd8 100644 --- a/src/utils/Game.ts +++ b/src/utils/Game.ts @@ -47,6 +47,20 @@ export class Game { this.player_len--; }; + public start_error(): string { + /** + * This function gives the error as to why the game is not able to + * start to be able to send it to the client. If the return string is + * empty that means that the game is able to be started. + * + * @return The error that prevents the game from starting. + */ + if (this.player_len <= 4) { + return `Cannot start game with less than 4 players.`; + }; + return ``; + }; + public toString(): string { let player_count = Object.keys(this._players).length; return `Game(code=${this.code},players=${player_count})`;