Решение на От ливадите до Лас Вегас (и назад) от Дейвид Каменов

Обратно към всички решения

Към профила на Дейвид Каменов

Резултати

  • 3 точки от тестове
  • 1 бонус точка
  • 4 точки общо
  • 5 успешни тест(а)
  • 10 неуспешни тест(а)

Код

"""
Homework3 Python
Created by David Kamenov
Version 1.2 Fixed the rest of the errors according to the code review
Where there is 'fixed' in comment it means fixed according to the code review comments
"""
import random
class Card:
# Fixed the new lines problem
all_suits = {'clubs', 'diamonds', 'hearts', 'spades'}
all_faces = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K', 'A'}
def __init__(self, suit, face):
# Fixed the protected type
self._suit = None
self._face = None
self.set_suit(suit)
self.set_face(face)
# Fixed added try except block
# Fixed do not set the default value but interrupt the program
def set_suit(self, suit):

Смятам, че тези проверки са по-скоро излишни. Ако се опиташ да инстанцираш несъщестуваща карта, по-удачно е да хвърлиш грешка, а не да приемаш дадена стойност.

try:
if suit in self.all_suits:
self._suit = str(suit)
else:
raise ValueError
except ValueError:
print("Inputted invalid suit!")
# exit() # not sure if this is necessary
# Fixed added try except block
def set_face(self, face):
try:
if face in self.all_faces:
self._face = face
else:
raise ValueError
except ValueError:
print("Inputted invalid face!")
# exit() # not sure if this is necessary
def get_suit(self):
return self._suit
def get_face(self):
return self._face
def __repr__(self):
return self._suit + ' ' + self._face
class Deck:
def __init__(self, face_filter=None):
self.card = None
self.all_cards = []
# face_filter -> which cards to be added
# Fixed merge the two block together because they are identical
temp = face_filter if face_filter is not None else Card.all_faces
for face in temp:
for suit in Card.all_suits:
self.all_cards.append(Card(suit, face))
def cut(self):
# Fixed at least one card changed in the cut is a valid cut
random_cut_position = random.randint(1, len(self.all_cards))
new_deck = self.all_cards[random_cut_position:]
new_deck += self.all_cards[:random_cut_position]
self.all_cards = new_deck
def shuffle(self):
random.shuffle(self.all_cards)
def get_cards(self):
return self.all_cards
def add_cards(self, new_cards):
self.all_cards += new_cards
class Player:
def __init__(self):
self.deck = []
def get_cards(self):
return self.deck
def add_card(self, new_card):
self.deck.append(new_card)
class Game:
def __init__(self, number_of_players, dealing_direction, dealing_instructions):
self.players = []
# Fixed used _ for unused variable
for _ in range(number_of_players):
self.players.append(Player())
self.number_of_players = number_of_players
# Fixed added try catch
# Fixed typo in the rtr -> rtl
try:
if dealing_direction == ('ltr' or 'rtl'):
self.dealing_direction = dealing_direction
else:
raise ValueError
except ValueError:
print("Inputted invalid direction!")
# exit() # not exactly sure if this is necessary
self.dealing_instructions = dealing_instructions
# Fixed variable name
self.deck = Deck()
def get_players(self):
return self.players
# get added cards and add them to the deck
def prepare_deck(self):
for new_player in self.players:
self.deck.add_cards(new_player.get_cards())
self.deck.shuffle()
self.deck.cut()
# Fixed the repeated code here
def deal(self, player):
player_index = self.players.index(player)
# todo check if the external function works properly
def temp_func(index, cards_cnt):
# FIXED TODO possible error here count_cards is type int
for times in range(cards_cnt): # gives cards according to the number;
self.players[index].add_card(self.deck.get_cards().pop())
for count_cards in self.dealing_instructions: # how many cards per giving
if self.dealing_direction == 'rtl':
# from player index to end
# fixed variable name
for ind in range(player_index, self.number_of_players):
temp_func(ind, count_cards)
# from the beginning to the player index
# fixed remove range(0, player_index)
for ind in range(player_index):
temp_func(ind, count_cards)
else:
for ind in range(player_index, -1, -1):
temp_func(ind, count_cards)
for ind in range(self.number_of_players, player_index, -1):
temp_func(ind, count_cards)
def get_deck(self):
return self.deck
class Belot(Game):
def __init__(self):
super().__init__(4, 'ltr', (2, 3, 3))
self.deck = Deck(['7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
class Poker(Game):
def __init__(self):
super().__init__(9, 'rtl', (1, 1, 1, 1, 1))

Лог от изпълнението

FEF
Stdout:
Inputted invalid face!
..FF.EEE..FE
======================================================================
ERROR: test_correct_direction_and_players_deal (test.TestBelot)
Test dealing with correct direction and players.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
IndexError: list index out of range

======================================================================
ERROR: test_collecting_cards_before_dealing (test.TestGame)
Test collecting the cards before a new deal.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
IndexError: list index out of range

======================================================================
ERROR: test_dealing_ltr (test.TestGame)
Test dealing the cards left to right.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
IndexError: list index out of range

======================================================================
ERROR: test_dealing_rtl (test.TestGame)
Test dealing the cards right to left.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AttributeError: 'Game' object has no attribute 'dealing_direction'

======================================================================
ERROR: test_correct_direction_and_players_deal (test.TestPoker)
Test dealing with correct direction and players.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AttributeError: 'Poker' object has no attribute 'dealing_direction'

======================================================================
FAIL: test_correct_deck_init (test.TestBelot)
Test initialization with correct deck.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AssertionError: Items in the first set but not the second:
('diamonds', '10')
('spades', '10')
('hearts', '10')
('clubs', '10')
Items in the second set but not the first:
('hearts', None)
('clubs', None)
('diamonds', None)
('spades', None)

======================================================================
FAIL: test_get_face (test.TestCard)
Test the get_face method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AssertionError: None != '10'

Stdout:
Inputted invalid face!

======================================================================
FAIL: test_init_filtered (test.TestDeck)
Test initialized cards with filter.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AssertionError: Items in the first set but not the second:
('diamonds', '10')
('spades', '10')
('hearts', '10')
('clubs', '10')
Items in the second set but not the first:
('hearts', None)
('clubs', None)
('diamonds', None)
('spades', None)

======================================================================
FAIL: test_init_regular (test.TestDeck)
Test initialized cards without filter.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AssertionError: Items in the first set but not the second:
('diamonds', '10')
('spades', '10')
('hearts', '10')
('clubs', '10')

======================================================================
FAIL: test_correct_deck_init (test.TestPoker)
Test initialization with correct deck.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/storage/deedee/data/rails/pyfmi-2022/releases/20221115154139/lib/language/python/runner.py", line 67, in thread
    raise result
AssertionError: Items in the first set but not the second:
('diamonds', '10')
('spades', '10')
('hearts', '10')
('clubs', '10')

----------------------------------------------------------------------
Ran 15 tests in 0.208s

FAILED (failures=5, errors=5)

История (3 версии и 16 коментара)

Дейвид обнови решението на 10.11.2022 02:01 (преди над 1 година)

+'''
+ Homework3 Python
+ Created by David Kamenov
+ Version 1.0. Created Homework
+
+'''
+
+import random
+
+
+# Done
+class Card:
+ all_suits = {
+ 'clubs',
+ 'diamonds',
+ 'hearts',
+ 'spades'
+ }
+
+ all_faces = {
+ '2',
+ '3',
+ '4',
+ '5',
+ '6',
+ '7',
+ '8',
+ '9',
+ 'J',
+ 'Q',
+ 'K',
+ 'A'
+ }
+
+ def __init__(self, suit, face):
+ self.suit = None
+ self.face = None
+ self.set_suit(suit)
+ self.set_face(face)
+
+ def set_suit(self, suit):

Смятам, че тези проверки са по-скоро излишни. Ако се опиташ да инстанцираш несъщестуваща карта, по-удачно е да хвърлиш грешка, а не да приемаш дадена стойност.

+ self.suit = str(suit) if suit in self.all_suits else 'clubs'
+
+ def set_face(self, face):
+ self.face = str(face) if face in self.all_faces else '2'
+
+ def get_suit(self):
+ return self.suit
+
+ def get_face(self):
+ return self.face
+
+ # prints the object in human-readable format
+ def __repr__(self):
+ return self.suit + ' ' + self.face
+
+
+# Done
+class Deck:
+ def __init__(self, face_filter=None):
+ self.card = None
+ self.all_cards = []
+ # face_filter = which cards to be added
+ if face_filter is not None:
+ for face in face_filter:
+ for suit in Card.all_suits:
+ self.all_cards.append(Card(suit, face))
+ else: # if face_filter is none add all possible cards
+ for face in Card.all_faces:
+ for suit in Card.all_suits:
+ self.all_cards.append(Card(suit, face))
+
+ def cut(self):
+ random_cur_position = random.randint(0, len(self.all_cards))
+
+ new_deck = self.all_cards[random_cur_position:]
+ new_deck += self.all_cards[:random_cur_position]
+
+ self.all_cards = new_deck
+
+ def shuffle(self):
+ random.shuffle(self.all_cards)
+
+ def get_cards(self):
+ return self.all_cards
+
+ def add_cards(self, new_cards):
+ self.all_cards += new_cards
+
+
+# Done
+class Player:
+ def __init__(self):
+ self.deck = []
+
+ def get_cards(self):
+ return self.deck
+
+ def add_card(self, new_card):
+ self.deck.append(new_card)
+
+
+class Game:
+ def __init__(self, number_of_players, dealing_direction, dealing_instructions):
+ self.players = []
+ for new_player in range(number_of_players):
+ self.players.append(Player())
+
+ self.number_of_players = number_of_players # maybe unnecessary
+
+ if dealing_direction == ('ltr' or 'rtr'):
+ self.dealing_direction = dealing_direction
+
+ self.dealing_instructions = dealing_instructions
+ self.new_deck = Deck()
+
+ def get_players(self):
+ return self.players
+
+ def prepare_deck(self):
+ # get added cards and add them to the deck
+ for new_player in self.players:
+ self.new_deck.add_cards(new_player.get_cards())
+
+ self.new_deck.shuffle()
+ self.new_deck.cut()
+
+ # todo to be fixed here repeted code
+ def deal(self, player):
+ player_index = self.players.index(player)
+
+ for count_cards in self.dealing_instructions: # how many cards per giving
+ if self.dealing_direction == 'rtl': # todo remove the if outside
+ for j in range(player_index, self.number_of_players):
+ # todo make a function not to be repeated 4 times
+ for times in count_cards: # gives cards according to the number;
+ self.players[j].add_card(self.new_deck.get_cards().pop())
+
+ # if started from middle to get back from the beginning
+ for j in range(0, player_index):
+ for times in count_cards:
+ self.players[j].add_card(self.new_deck.get_cards().pop())
+
+ else:
+ for j in range(player_index, -1, -1):
+ for times in count_cards:
+ self.players[j].add_card(self.new_deck.get_cards().pop())
+
+ for j in range(self.number_of_players, player_index, -1):
+ for times in count_cards:
+ self.players[j].add_card(self.new_deck.get_cards().pop())
+
+ def get_deck(self):
+ return self.new_deck
+
+
+class Belot(Game):
+ def __init__(self):
+ super().__init__(4, 'ltr', (2, 3, 3))
+ self.new_deck = Deck(['7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
+
+
+class Poker(Game):
+ def __init__(self):
+ super().__init__(9, 'rtl', (1, 1, 1, 1, 1))

Досега винаги съм харесвал коментарите ти, но този път си се престарал. Доста от нещата са били временно сложени и е време да ги махнеш. Виждам, че имаш TODO неща, с които съм съгласен да оставиш, но имаш коментари, които не носят информация за другите хора. Когато си готов да събмитнеш кода си, изчисти го от подобни неща.
Например:
# Done - излишно, само на теб ти върши работа
# prints the object in human-readable format - това обяснява как работи Python, така че излишно.

Дейвид обнови решението на 11.11.2022 14:16 (преди над 1 година)

-'''
+"""
Homework3 Python
Created by David Kamenov
- Version 1.0. Created Homework
+ Version 1.1 Fixed some of the errors according to the code review
+"""
-'''
-
import random
-# Done
class Card:
- all_suits = {
- 'clubs',
- 'diamonds',
- 'hearts',
- 'spades'
- }
+ # Fixed the new lines problem
+ all_suits = {'clubs', 'diamonds', 'hearts', 'spades'}
- all_faces = {
- '2',
- '3',
- '4',
- '5',
- '6',
- '7',
- '8',
- '9',
- 'J',
- 'Q',
- 'K',
- 'A'
- }
+ all_faces = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K', 'A'}
def __init__(self, suit, face):
- self.suit = None
- self.face = None
+ # Fixed the protected type
+ self._suit = None
+ self._face = None
self.set_suit(suit)
self.set_face(face)
+ # TODO maybe use try match here
+ # Fixed the do not set the default value but interrupt the program
def set_suit(self, suit):
- self.suit = str(suit) if suit in self.all_suits else 'clubs'
+ if suit in self.all_suits:
+ self._suit = str(suit)
+ else:
+ print("Inputted a suit that does not exist")
+ # TODO with try catch
def set_face(self, face):
- self.face = str(face) if face in self.all_faces else '2'
+ if face in self.all_faces:
+ self._face = str(face)
+ else:
+ print("Inputted a face that does not exist")
def get_suit(self):
- return self.suit
+ return self._suit
def get_face(self):
- return self.face
+ return self._face
- # prints the object in human-readable format
def __repr__(self):
- return self.suit + ' ' + self.face
+ return self._suit + ' ' + self._face
-# Done
class Deck:
def __init__(self, face_filter=None):
self.card = None
self.all_cards = []
- # face_filter = which cards to be added
+ # face_filter -> which cards to be added
+
+ # TODO merge the two block together because they are identical
if face_filter is not None:
for face in face_filter:
for suit in Card.all_suits:
self.all_cards.append(Card(suit, face))
else: # if face_filter is none add all possible cards
for face in Card.all_faces:
for suit in Card.all_suits:
self.all_cards.append(Card(suit, face))
def cut(self):
- random_cur_position = random.randint(0, len(self.all_cards))
+ # Fixed at least one card changed in the cut is a valid cut
+ random_cut_position = random.randint(1, len(self.all_cards))
- new_deck = self.all_cards[random_cur_position:]
- new_deck += self.all_cards[:random_cur_position]
+ new_deck = self.all_cards[random_cut_position:]
+ new_deck += self.all_cards[:random_cut_position]
self.all_cards = new_deck
def shuffle(self):
random.shuffle(self.all_cards)
def get_cards(self):
return self.all_cards
def add_cards(self, new_cards):
self.all_cards += new_cards
-# Done
class Player:
def __init__(self):
self.deck = []
def get_cards(self):
return self.deck
def add_card(self, new_card):
self.deck.append(new_card)
class Game:
def __init__(self, number_of_players, dealing_direction, dealing_instructions):
self.players = []
- for new_player in range(number_of_players):
+ # Fixed used _ for unused variable
+ for _ in range(number_of_players):
self.players.append(Player())
- self.number_of_players = number_of_players # maybe unnecessary
+ self.number_of_players = number_of_players
- if dealing_direction == ('ltr' or 'rtr'):
+ # todo use try catch here and throw error
+ # Fixed typo in the rtr -> rtl
+ if dealing_direction == ('ltr' or 'rtl'):
self.dealing_direction = dealing_direction
self.dealing_instructions = dealing_instructions
- self.new_deck = Deck()
+ # Fixed variable name
+ self.deck = Deck()
def get_players(self):
return self.players
+ # get added cards and add them to the deck
def prepare_deck(self):
- # get added cards and add them to the deck
for new_player in self.players:
- self.new_deck.add_cards(new_player.get_cards())
+ self.deck.add_cards(new_player.get_cards())
- self.new_deck.shuffle()
- self.new_deck.cut()
+ self.deck.shuffle()
+ self.deck.cut()
- # todo to be fixed here repeted code
+ # Fixed the repeted code here
def deal(self, player):
player_index = self.players.index(player)
+ # todo check if this works properly
+ def temp_func(index):
+ # !!!TODO possible error here count_cards is type int
+ for times in count_cards: # gives cards according to the number;
+ self.players[index].add_card(self.deck.get_cards().pop())
+
for count_cards in self.dealing_instructions: # how many cards per giving
- if self.dealing_direction == 'rtl': # todo remove the if outside
- for j in range(player_index, self.number_of_players):
- # todo make a function not to be repeated 4 times
- for times in count_cards: # gives cards according to the number;
- self.players[j].add_card(self.new_deck.get_cards().pop())
+ if self.dealing_direction == 'rtl':
+ # from player index to end
+ # fixed variable name
+ for ind in range(player_index, self.number_of_players):
+ temp_func(ind)
- # if started from middle to get back from the beginning
- for j in range(0, player_index):
- for times in count_cards:
- self.players[j].add_card(self.new_deck.get_cards().pop())
+ # from the beginning to the player index
+ # fixed remove range(0, player_index)
+ for ind in range(player_index):
+ temp_func(ind)
else:
- for j in range(player_index, -1, -1):
- for times in count_cards:
- self.players[j].add_card(self.new_deck.get_cards().pop())
+ for ind in range(player_index, -1, -1):
+ temp_func(ind)
- for j in range(self.number_of_players, player_index, -1):
- for times in count_cards:
- self.players[j].add_card(self.new_deck.get_cards().pop())
+ for ind in range(self.number_of_players, player_index, -1):
+ temp_func(ind)
def get_deck(self):
- return self.new_deck
+ return self.deck
class Belot(Game):
def __init__(self):
super().__init__(4, 'ltr', (2, 3, 3))
- self.new_deck = Deck(['7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
+ self.deck = Deck(['7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
class Poker(Game):
def __init__(self):
super().__init__(9, 'rtl', (1, 1, 1, 1, 1))

Дейвид обнови решението на 11.11.2022 15:20 (преди над 1 година)

"""
Homework3 Python
Created by David Kamenov
- Version 1.1 Fixed some of the errors according to the code review
+ Version 1.2 Fixed the rest of the errors according to the code review
+
+ Where there is 'fixed' in comment it means fixed according to the code review comments
"""
import random
class Card:
# Fixed the new lines problem
all_suits = {'clubs', 'diamonds', 'hearts', 'spades'}
all_faces = {'2', '3', '4', '5', '6', '7', '8', '9', 'J', 'Q', 'K', 'A'}
def __init__(self, suit, face):
# Fixed the protected type
self._suit = None
self._face = None
self.set_suit(suit)
self.set_face(face)
- # TODO maybe use try match here
- # Fixed the do not set the default value but interrupt the program
+ # Fixed added try except block
+ # Fixed do not set the default value but interrupt the program
def set_suit(self, suit):
- if suit in self.all_suits:
- self._suit = str(suit)
- else:
- print("Inputted a suit that does not exist")
+ try:
+ if suit in self.all_suits:
+ self._suit = str(suit)
+ else:
+ raise ValueError
+ except ValueError:
+ print("Inputted invalid suit!")
+ # exit() # not sure if this is necessary
- # TODO with try catch
+ # Fixed added try except block
def set_face(self, face):
- if face in self.all_faces:
- self._face = str(face)
- else:
- print("Inputted a face that does not exist")
+ try:
+ if face in self.all_faces:
+ self._face = face
+ else:
+ raise ValueError
+ except ValueError:
+ print("Inputted invalid face!")
+ # exit() # not sure if this is necessary
def get_suit(self):
return self._suit
def get_face(self):
return self._face
def __repr__(self):
return self._suit + ' ' + self._face
class Deck:
def __init__(self, face_filter=None):
self.card = None
self.all_cards = []
# face_filter -> which cards to be added
- # TODO merge the two block together because they are identical
- if face_filter is not None:
- for face in face_filter:
- for suit in Card.all_suits:
- self.all_cards.append(Card(suit, face))
- else: # if face_filter is none add all possible cards
- for face in Card.all_faces:
- for suit in Card.all_suits:
- self.all_cards.append(Card(suit, face))
+ # Fixed merge the two block together because they are identical
+ temp = face_filter if face_filter is not None else Card.all_faces
+ for face in temp:
+ for suit in Card.all_suits:
+ self.all_cards.append(Card(suit, face))
def cut(self):
# Fixed at least one card changed in the cut is a valid cut
random_cut_position = random.randint(1, len(self.all_cards))
new_deck = self.all_cards[random_cut_position:]
new_deck += self.all_cards[:random_cut_position]
self.all_cards = new_deck
def shuffle(self):
random.shuffle(self.all_cards)
def get_cards(self):
return self.all_cards
def add_cards(self, new_cards):
self.all_cards += new_cards
class Player:
def __init__(self):
self.deck = []
def get_cards(self):
return self.deck
def add_card(self, new_card):
self.deck.append(new_card)
class Game:
def __init__(self, number_of_players, dealing_direction, dealing_instructions):
self.players = []
# Fixed used _ for unused variable
for _ in range(number_of_players):
self.players.append(Player())
self.number_of_players = number_of_players
- # todo use try catch here and throw error
+ # Fixed added try catch
# Fixed typo in the rtr -> rtl
- if dealing_direction == ('ltr' or 'rtl'):
- self.dealing_direction = dealing_direction
+ try:
+ if dealing_direction == ('ltr' or 'rtl'):
+ self.dealing_direction = dealing_direction
+ else:
+ raise ValueError
+ except ValueError:
+ print("Inputted invalid direction!")
+ # exit() # not exactly sure if this is necessary
self.dealing_instructions = dealing_instructions
# Fixed variable name
self.deck = Deck()
def get_players(self):
return self.players
# get added cards and add them to the deck
def prepare_deck(self):
for new_player in self.players:
self.deck.add_cards(new_player.get_cards())
self.deck.shuffle()
self.deck.cut()
- # Fixed the repeted code here
+ # Fixed the repeated code here
def deal(self, player):
player_index = self.players.index(player)
- # todo check if this works properly
- def temp_func(index):
- # !!!TODO possible error here count_cards is type int
- for times in count_cards: # gives cards according to the number;
+ # todo check if the external function works properly
+ def temp_func(index, cards_cnt):
+ # FIXED TODO possible error here count_cards is type int
+ for times in range(cards_cnt): # gives cards according to the number;
self.players[index].add_card(self.deck.get_cards().pop())
for count_cards in self.dealing_instructions: # how many cards per giving
if self.dealing_direction == 'rtl':
# from player index to end
# fixed variable name
for ind in range(player_index, self.number_of_players):
- temp_func(ind)
+ temp_func(ind, count_cards)
# from the beginning to the player index
# fixed remove range(0, player_index)
for ind in range(player_index):
- temp_func(ind)
+ temp_func(ind, count_cards)
else:
for ind in range(player_index, -1, -1):
- temp_func(ind)
+ temp_func(ind, count_cards)
for ind in range(self.number_of_players, player_index, -1):
- temp_func(ind)
+ temp_func(ind, count_cards)
def get_deck(self):
return self.deck
class Belot(Game):
def __init__(self):
super().__init__(4, 'ltr', (2, 3, 3))
self.deck = Deck(['7', '8', '9', '10', 'J', 'Q', 'K', 'A'])
class Poker(Game):
def __init__(self):
super().__init__(9, 'rtl', (1, 1, 1, 1, 1))

Версия 1.2: Оправени останалите грешки спрямо ревюто; добавени try except блокове при невалидна стойност (без да терминират програмата, защото иначе гърмят някои от примерните тестове); оправен е проблема с итериране на int без да има range. Където в коментар пише fixed това са оправени неща спрямо code review-то

Компенсирам с една точка за старателното адресиране на коментари и факта, че грешката с липсващата десетка е достатъчно "тъпа", че да не си заслужава да афектира точките ти толкова сериозно. Само една, за да е честно спрямо останалите. Нека това не те успокоява, а напротив, да те подтикне да тестваш по-добре в следващите задачи.