Bug 817 - Draw one card from Deck leads to unplayedCards and playedCards incorrectly generated
Summary: Draw one card from Deck leads to unplayedCards and playedCards incorrectly ge...
Status: RESOLVED INVALID
Alias: None
Product: .CS3343 Group2 2324A Uno Game
Classification: Unclassified
Component: Deck (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- enhancement
Assignee: tinloklee2-c
URL:
Depends on:
Blocks:
 
Reported: 2023-12-08 00:17 HKT by kaiskafel2-c
Modified: 2023-12-11 22:00 HKT (History)
0 users

See Also:


Attachments
Attachment: unplayedCards and playedCards incorrectly generated (197.32 KB, image/jpeg)
2023-12-08 00:17 HKT, kaiskafel2-c
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kaiskafel2-c 2023-12-08 00:17:24 HKT
Created attachment 165 [details]
Attachment: unplayedCards and playedCards incorrectly generated

The current unplayedCards is empty and playedCards consist of more than 1 cards.

Steps to reproduce:
1. Run the program 
2. Play the game until unplayedCards are empty but playedCards consist more than 1 cards
3. Draw one card from deck
3. Alternative: attached test case

Expected result: playedCards is empty and unplayedCards consist of all Cards except the card just taken from the Deck

Actual result: playedCards is not empty and unplayedCards consist of less Cards expected
Comment 1 tinloklee2-c 2023-12-08 16:41:22 HKT
This is not a bug but by design.

Explanation (using your the case)
Before the action, unplayedCards.size() = 0 & playedCards.size() = 2

During the action, all playedCards **EXCEPT the top card** would be moved from playedCards to unplayedCards. Then, unplayedCards would be reshuffled.
unplayedCards.size() = 1 & playedCards.size() = 1

After the action, unplayedCards is available for drawing. Player draws card.
Finally, unplayedCards.size() = 0 & playedCards.size() = 1, in which we obtain the same result as your test case.

Thank you for your debugging efforts!