Решение на От ливадите до Лас Вегас (и назад) от Цветан Тошев
Обратно към всички решения
Към профила на Цветан Тошев
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 4 успешни тест(а)
- 11 неуспешни тест(а)
Код
Лог от изпълнението
[[2 of spades, 3 of spades, 4 of spades, 5 of spades, 6 of spades, 7 of spades, 8 of spades, 9 of spades, 10 of spades, J of spades, Q of spades, K of spades, A of spades, 2 of clubs, 3 of clubs, 4 of clubs, 5 of clubs, 6 of clubs, 7 of clubs, 8 of clubs, 9 of clubs, 10 of clubs, J of clubs, Q of clubs, K of clubs, A of clubs, 2 of diamonds, 3 of diamonds, 4 of diamonds, 5 of diamonds, 6 of diamonds, 7 of diamonds], [2 of spades, 3 of spades, 4 of spades, 5 of spades, 6 of spades, 7 of spades, 8 of spades, 9 of spades, 10 of spades, J of spades, Q of spades, K of spades, A of spades, 2 of clubs, 3 of clubs, 4 of clubs, 5 of clubs, 6 of clubs, 7 of clubs, 8 of clubs, 9 of clubs, 10 of clubs, J of clubs, Q of clubs, K of clubs, A of clubs, 2 of diamonds, 3 of diamonds, 4 of diamonds, 5 of diamonds, 6 of diamonds, 7 of diamonds], [2 of spades, 3 of spades, 4 of spades, 5 of spades, 6 of spades, 7 of spades, 8 of spades, 9 of spades, 10 of spades, J of spades, Q of spades, K of spades, A of spades, 2 of clubs, 3 of clubs, 4 of clubs, 5 of clubs, 6 of clubs, 7 of clubs, 8 of clubs, 9 of clubs, 10 of clubs, J of clubs, Q of clubs, K of clubs, A of clubs, 2 of diamonds, 3 of diamonds, 4 of diamonds, 5 of diamonds, 6 of diamonds, 7 of diamonds], [2 of spades, 3 of spades, 4 of spades, 5 of spades, 6 of spades, 7 of spades, 8 of spades, 9 of spades, 10 of spades, J of spades, Q of spades, K of spades, A of spades, 2 of clubs, 3 of clubs, 4 of clubs, 5 of clubs, 6 of clubs, 7 of clubs, 8 of clubs, 9 of clubs, 10 of clubs, J of clubs, Q of clubs, K of clubs, A of clubs, 2 of diamonds, 3 of diamonds, 4 of diamonds, 5 of diamonds, 6 of diamonds, 7 of diamonds]]
FF...FF.EEEFEEE
======================================================================
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: 'Player' object has no attribute 'cards'
======================================================================
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: 'Game' object has no attribute 'deck_for_game'
======================================================================
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 'deck_for_game'
======================================================================
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: 'Player' object has no attribute 'cards'
======================================================================
ERROR: 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
AttributeError: 'Poker' object has no attribute 'deck_for_game'
======================================================================
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 'deck_for_game'
======================================================================
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 second set but not the first:
('spades', '3')
('spades', '4')
('spades', '5')
('diamonds', '2')
('hearts', '2')
('clubs', '3')
('clubs', '4')
('clubs', '5')
('spades', '2')
('diamonds', '6')
('hearts', '6')
('clubs', '2')
('spades', '6')
('diamonds', '4')
('hearts', '4')
('clubs', '6')
('diamonds', '3')
('hearts', '3')
('diamonds', '5')
('hearts', '5')
======================================================================
FAIL: 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
AssertionError: 8 != 4
======================================================================
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 second set but not the first:
('hearts', '8')
('hearts', '6')
('diamonds', 'K')
('spades', 'K')
('hearts', '7')
('diamonds', 'Q')
('hearts', 'K')
('diamonds', '9')
('hearts', '4')
('hearts', 'Q')
('hearts', '9')
('hearts', '3')
('diamonds', '8')
('clubs', 'K')
======================================================================
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: 80 != 52
======================================================================
FAIL: test_players_creation (test.TestGame)
Test creation and retrieval of 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: 11 != 2
----------------------------------------------------------------------
Ran 15 tests in 0.209s
FAILED (failures=5, errors=6)
История (2 версии и 13 коментара)
Цветан обнови решението на 14.11.2022 16:09 (преди над 2 години)
Цветан обнови решението на 14.11.2022 22:03 (преди над 2 години)
Тук е хубаво (да не кажа задължително според PEP8) да оставиш два празни реда след импорта.
Би могъл да направиш една променлива с лицата, за да спестиш повторението на код в тези два почти идентични блока.
Добре е да имаш случаен елемент, а не винаги да цепиш посредата. Реално погледнато това е частен случай, пред който тестовете ще са доволни, но ако правиш истинска игра, би било добре да има случаен характер.