Not letting valid card be played, not being able to draw, illegal card on discard pile
Closed this issue · 4 comments
eZSnake commented
-=-= Player 2's turn =-=-
Place pile card:
Blue +2
Your cards:
Card 1: Red 8
Card 2: Blue 9
What card would you like to play or would you like to draw? (1-2/'draw','d'): 9
That is an invalid number. Enter one between 1 and 2: 2
That is an invalid number. Enter one between 1 and 2: 1
That is an invalid number. Enter one between 1 and 2: d
*** Error in input: Integer value not found in input.
*** Expecting: Integer in the range -2147483648 to 2147483647
*** Discarding Input: d
Please re-enter: 2
That is an invalid number. Enter one between 1 and 2: 1
That is an invalid number. Enter one between 1 and 2: 0
That is an invalid number. Enter one between 1 and 2:
eZSnake commented
newest push has fixed this partly; now accepts 'd' but not a valid card to play
eZSnake commented
Place pile card:
Blue 1
Your cards:
Card 1: Blue +2
Card 2: Red Skip
Card 3: Red 7
Card 4: Blue 2
Card 5: Blue 5
Card 6: Red 3
Card 7: Blue 6
What card would you like to play or would you like to draw? (1-7/'draw','d'): 9
That is an invalid number. Enter one between 1 and 7: 4
That is an invalid number. Enter one between 1 and 7: d
eZSnake commented
Place pile card:
Green 6
Your cards:
Card 1: Green 7
Card 2: Green Switch
Card 3: Red 4
Card 4: Green +2
Card 5: Yellow 0
Card 6: Yellow 1
Card 7: Green 4
What card would you like to play or would you like to draw? (1-7/'draw','d'): 0
That is an invalid number. Enter one between 1 and 7: d
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:422)
at java.util.ArrayList.get(ArrayList.java:435)
at Hand.getCard(Hand.java:19)
at UnoGame.playRound(UnoGame.java:60)
at UnoRunner.main(UnoRunner.java:13)
eZSnake commented
issue was cardInt being set so not being -1 and therefore it tried checking a card that was out of bounds