From 404002c50e262e2782c13c0f6c2501cceec565f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Sender=C3=A1k?= Date: Fri, 27 Mar 2020 22:27:24 +0100 Subject: [PATCH] Round - input valdation fix --- game.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game.py b/game.py index cb79fed..b765a52 100644 --- a/game.py +++ b/game.py @@ -96,8 +96,10 @@ class Series(): class Round(): def __init__(self, round_number: int, first_player: int, cards: []=cards, shuffler = shuffle): # vyrob kopku pre toto kolo a priprav prazdne objekty - if not 0 <= round_number < 8: - raise BridzikException('Round number has to be between 0 and 7.') + if round_number not in [i for i in range(8)]: + raise BridzikException('Neplatne cislo kola.') + if first_player not in [0, 1, 2, 3]: + raise BridzikException('Cislo hraca musi byt 0, 1, 2 alebo 3.') self.round_number = round_number self.first_player = first_player self.deal_starting_cards(cards, shuffler)