Решение на От ливадите до Лас Вегас (и назад) от Стоян Михайлов
Обратно към всички решения
Към профила на Стоян Михайлов
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 5 успешни тест(а)
- 10 неуспешни тест(а)
Код
Лог от изпълнението
F..F.FF.EEE.EFF
======================================================================
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
AttributeError: 'NoneType' object has no attribute 'shuffle'
======================================================================
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
AttributeError: 'NoneType' object has no attribute 'get_cards'
======================================================================
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: 'NoneType' object has no attribute 'get_cards'
======================================================================
ERROR: test_prepare_deck (test.TestGame)
Test preparing the deck for dealing.
----------------------------------------------------------------------
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: 'NoneType' object has no attribute 'shuffle'
======================================================================
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:
('clubs', 'K')
('clubs', 'A')
('hearts', '9')
('diamonds', '10')
('hearts', '7')
('clubs', '7')
('clubs', '9')
('spades', '8')
('hearts', 'J')
('clubs', 'J')
('clubs', 'Q')
('diamonds', '8')
('hearts', '10')
('clubs', '10')
('spades', 'Q')
('spades', 'K')
('spades', 'A')
('hearts', '8')
('clubs', '8')
('diamonds', 'Q')
('diamonds', 'K')
('diamonds', 'A')
('spades', '9')
('spades', '7')
('diamonds', '9')
('spades', 'J')
('diamonds', '7')
('diamonds', 'J')
('hearts', 'Q')
('hearts', 'K')
('hearts', 'A')
('spades', '10')
Items in the second set but not the first:
('SPADES', 'J')
('DIAMONDS', '10')
('HEARTS', 'Q')
('HEARTS', 'K')
('CLUBS', '10')
('HEARTS', 'A')
('CLUBS', 'J')
('DIAMONDS', '8')
('SPADES', '10')
('HEARTS', '9')
('HEARTS', '7')
('CLUBS', '8')
('HEARTS', 'J')
('SPADES', '8')
('HEARTS', '10')
('DIAMONDS', 'Q')
('DIAMONDS', 'K')
('DIAMONDS', 'A')
('CLUBS', 'Q')
('DIAMONDS', '9')
('CLUBS', 'A')
('HEARTS', '8')
('SPADES', 'Q')
('DIAMONDS', '7')
('CLUBS', 'K')
('SPADES', 'K')
('SPADES', 'A')
('CLUBS', '9')
('DIAMONDS', 'J')
('CLUBS', '7')
('SPADES', '9')
('SPADES', '7')
======================================================================
FAIL: test_get_suit (test.TestCard)
Test the get_suit 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: 'SPADES' != 'spades'
- SPADES
+ spades
======================================================================
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:
('clubs', '2')
('clubs', 'A')
('diamonds', '5')
('diamonds', '10')
('hearts', 'J')
('clubs', 'J')
('hearts', '5')
('hearts', '10')
('clubs', '5')
('clubs', '10')
('spades', '2')
('spades', 'A')
('diamonds', '2')
('diamonds', 'A')
('spades', 'J')
('diamonds', 'J')
('hearts', 'A')
('spades', '5')
('spades', '10')
('hearts', '2')
Items in the second set but not the first:
('SPADES', 'J')
('DIAMONDS', '5')
('DIAMONDS', '10')
('CLUBS', '5')
('CLUBS', '10')
('HEARTS', '2')
('HEARTS', 'A')
('SPADES', '5')
('SPADES', '10')
('HEARTS', 'J')
('HEARTS', '5')
('HEARTS', '10')
('DIAMONDS', '2')
('DIAMONDS', 'A')
('CLUBS', 'A')
('CLUBS', '2')
('SPADES', '2')
('SPADES', 'A')
('DIAMONDS', 'J')
('CLUBS', 'J')
======================================================================
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:
('clubs', 'K')
('clubs', '2')
('clubs', 'A')
('hearts', '9')
('diamonds', '5')
('diamonds', '10')
('hearts', '6')
('hearts', '7')
('clubs', '6')
('clubs', '7')
('clubs', '9')
('spades', '8')
('hearts', 'J')
('hearts', '4')
('clubs', 'J')
('clubs', 'Q')
('clubs', '4')
('diamonds', '8')
('hearts', '5')
('hearts', '10')
('clubs', '5')
('clubs', '10')
('spades', '3')
('spades', 'Q')
('spades', '2')
('spades', 'K')
('spades', 'A')
('hearts', '8')
('clubs', '8')
('diamonds', '3')
('diamonds', 'Q')
('diamonds', '2')
('diamonds', 'K')
('diamonds', 'A')
('spades', '9')
('spades', '6')
('spades', '7')
('diamonds', '6')
('diamonds', '9')
('spades', 'J')
('diamonds', '7')
('spades', '4')
('hearts', '3')
('diamonds', 'J')
('hearts', 'Q')
('hearts', 'K')
('hearts', 'A')
('diamonds', '4')
('clubs', '3')
('spades', '10')
('hearts', '2')
('spades', '5')
Items in the second set but not the first:
('CLUBS', '4')
('SPADES', 'J')
('DIAMONDS', '5')
('DIAMONDS', '10')
('HEARTS', '3')
('HEARTS', 'Q')
('SPADES', '4')
('CLUBS', '5')
('CLUBS', '10')
('HEARTS', '2')
('HEARTS', 'K')
('HEARTS', 'A')
('SPADES', '5')
('SPADES', '10')
('DIAMONDS', '8')
('HEARTS', '6')
('HEARTS', '9')
('HEARTS', '7')
('CLUBS', '8')
('HEARTS', 'J')
('HEARTS', '4')
('SPADES', '8')
('SPADES', '7')
('DIAMONDS', '3')
('HEARTS', '5')
('DIAMONDS', '2')
('HEARTS', '10')
('DIAMONDS', 'Q')
('DIAMONDS', 'K')
('DIAMONDS', 'A')
('CLUBS', '3')
('CLUBS', 'Q')
('DIAMONDS', '9')
('CLUBS', 'A')
('HEARTS', '8')
('SPADES', 'Q')
('CLUBS', '2')
('DIAMONDS', '6')
('DIAMONDS', '7')
('CLUBS', 'K')
('SPADES', '3')
('SPADES', 'K')
('SPADES', '2')
('SPADES', 'A')
('CLUBS', '9')
('DIAMONDS', 'J')
('CLUBS', '6')
('CLUBS', '7')
('DIAMONDS', '4')
('SPADES', '6')
('SPADES', '9')
('CLUBS', 'J')
======================================================================
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:
('clubs', 'K')
('clubs', '2')
('clubs', 'A')
('hearts', '9')
('diamonds', '5')
('diamonds', '10')
('hearts', '6')
('hearts', '7')
('clubs', '6')
('clubs', '7')
('clubs', '9')
('spades', '8')
('hearts', 'J')
('hearts', '4')
('clubs', 'J')
('clubs', 'Q')
('clubs', '4')
('diamonds', '8')
('hearts', '5')
('hearts', '10')
('clubs', '5')
('clubs', '10')
('spades', '3')
('spades', 'Q')
('spades', '2')
('spades', 'K')
('spades', 'A')
('hearts', '8')
('clubs', '8')
('diamonds', '3')
('diamonds', 'Q')
('diamonds', '2')
('diamonds', 'K')
('diamonds', 'A')
('spades', '9')
('spades', '6')
('spades', '7')
('diamonds', '6')
('diamonds', '9')
('spades', 'J')
('diamonds', '7')
('spades', '4')
('hearts', '3')
('diamonds', 'J')
('hearts', 'Q')
('hearts', 'K')
('hearts', 'A')
('diamonds', '4')
('clubs', '3')
('spades', '10')
('hearts', '2')
('spades', '5')
Items in the second set but not the first:
('CLUBS', '4')
('SPADES', 'J')
('DIAMONDS', '5')
('DIAMONDS', '10')
('HEARTS', '3')
('HEARTS', 'Q')
('SPADES', '4')
('CLUBS', '5')
('CLUBS', '10')
('HEARTS', '2')
('HEARTS', 'K')
('HEARTS', 'A')
('SPADES', '5')
('SPADES', '10')
('DIAMONDS', '8')
('HEARTS', '6')
('HEARTS', '9')
('HEARTS', '7')
('CLUBS', '8')
('HEARTS', 'J')
('HEARTS', '4')
('SPADES', '8')
('SPADES', '7')
('DIAMONDS', '3')
('HEARTS', '5')
('DIAMONDS', '2')
('HEARTS', '10')
('DIAMONDS', 'Q')
('DIAMONDS', 'K')
('DIAMONDS', 'A')
('CLUBS', '3')
('CLUBS', 'Q')
('DIAMONDS', '9')
('CLUBS', 'A')
('HEARTS', '8')
('SPADES', 'Q')
('CLUBS', '2')
('DIAMONDS', '6')
('DIAMONDS', '7')
('CLUBS', 'K')
('SPADES', '3')
('SPADES', 'K')
('SPADES', '2')
('SPADES', 'A')
('CLUBS', '9')
('DIAMONDS', 'J')
('CLUBS', '6')
('CLUBS', '7')
('DIAMONDS', '4')
('SPADES', '6')
('SPADES', '9')
('CLUBS', 'J')
======================================================================
FAIL: 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
AssertionError: {('HEARTS', '10'), ('DIAMONDS', 'K'), ('CLUBS', '6'), ('DIAMONDS', '4'), ('SPADES', '8')} not found in ({('CLUBS', '4'), ('DIAMONDS', '2'), ('DIAMONDS', 'J'), ('SPADES', '6'), ('HEARTS', '8')}, {('DIAMONDS', '8'), ('HEARTS', '5'), ('CLUBS', '10'), ('HEARTS', 'A'), ('SPADES', 'Q')})
----------------------------------------------------------------------
Ran 15 tests in 0.183s
FAILED (failures=6, errors=4)
История (2 версии и 7 коментара)
Стоян обнови решението на 15.11.2022 16:14 (преди около 2 години)
Стоян обнови решението на 15.11.2022 17:30 (преди около 2 години)
Бих използвал protected имена на атрибути като тези, които не използваш извън класа -
self._suit
Можеш
self.face_filter = face_filter or ["2", "3",...]
По условие тези трябва да са с малки букви.
Когато не ти трябва променливата, именувай я
_
, както е по конвенция.Освен това
range(0, x)
е същото като `range(x)'Това трябва да е налично дори просто да инициализирам класа, без да го налседявам.
Използването на наклонена черта за пренасяне на ред е силно непрепоръчително. По-добре е да разделиш това на няколко реда с
if-else
.Моля виж становището по темата с долните черти: https://fmi.py-bg.net/tips/2