Bug 609

Summary: Need to handle when discard pile and deck are empty
Product: UNO Game Reporter: abbyshek2-c
Component: DeckManagerAssignee: zen268zzsyc
Status: CONFIRMED ---    
Severity: enhancement    
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   

Description abbyshek2-c 2021-11-24 21:45:54 HKT
Currently, the game will refill the deck with the discard pile. 

However, if all the player do not play card and keep drawing card, there are will

be case that both discard pile and deck are empty. Error occur as no card can be 

refilled.

Should modify the code the handle this case.

-----------------------------------------------------------------

Exception in thread "main" java.util.NoSuchElementException
at java.base/java.util.ArrayDeque.removeFirst(ArrayDeque.java:362)
at java.base/java.util.ArrayDeque.pop(ArrayDeque.java:593)
at com.cs3343.gp15.game.DeckManager.DrawCard(DeckManager.java:68)
at com.cs3343.gp15.game.GameManager.playerDrawCard(GameManager.java:162)
at com.cs3343.gp15.game.GameManager.drawProcess(GameManager.java:103)
at com.cs3343.gp15.game.GameManager.computerTurn(GameManager.java:115)
at com.cs3343.gp15.game.GameManager.playerAction(GameManager.java:74)
at com.cs3343.gp15.game.GameManager.gameProcess(GameManager.java:47)
at com.cs3343.gp15.game.Main.main(Main.java:13)