Round - input valdation fix

This commit is contained in:
Jakub Senderák
2020-03-27 22:27:24 +01:00
parent 5098a1aa9a
commit 404002c50e
+4 -2
View File
@@ -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)