Bug 817

Summary: Draw one card from Deck leads to unplayedCards and playedCards incorrectly generated
Product: .CS3343 Group2 2324A Uno Game Reporter: kaiskafel2-c
Component: DeckAssignee: tinloklee2-c
Status: RESOLVED INVALID    
Severity: enhancement    
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   
Attachments: Attachment: unplayedCards and playedCards incorrectly generated

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!