From 687b72edf1dd974fb5060dc3776218b58725eb0e Mon Sep 17 00:00:00 2001 From: DO97 Date: Sun, 16 Jun 2019 17:34:15 +0200 Subject: [PATCH] Error in case of 11th join (game started) Added a maximum of 10 player as specified in UNO official rules. This also prevents a deck empty error in case too much players have joined the game. --- game_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game_manager.py b/game_manager.py index ec49bc4..d1ea8af 100644 --- a/game_manager.py +++ b/game_manager.py @@ -23,7 +23,7 @@ import logging from game import Game from player import Player from errors import (AlreadyJoinedError, LobbyClosedError, NoGameInChatError, - NotEnoughPlayersError) + NotEnoughPlayersError, MaxPlayersError) class GameManager(object): @@ -69,6 +69,9 @@ class GameManager(object): if not game.open: raise LobbyClosedError() + if game.started and len(game.players) == 10: + raise MaxPlayersError() + if user.id not in self.userid_players: self.userid_players[user.id] = list()