I'm creating a card game assignment...
so i have an arraylist called cards that has 20 cards and every card has contains 2 objects, suit and the point Value.
I shuffled the deck, now i want to add half of it to player 1 and the rest of the cards goes to the bot or computer.
how can i add the cards to the player one arraylist and have all the information of the cards?
here is my Deck class code :-
how is your assignment going?
if I understand you correctly, you want to construct a deck of 20 cards( by the way, what kind of cards do you have in mind? if it's the regular cards, then shouldn't the deck has 52 cards?)
then divide it into two equal piles of ten cards and pass it to the user and computer, right?
I did look at the code that deals ten cards to each player and I'm not sure if this is the code that causing you runtime error, however I did notice that you are dealing 9 cards to each player instead of ten..you might want to check that out. better yet why don't you make a loop for 20, size of the deck, and for first ten give it to player and last give it to pc? or another idea would be why not use i%2 to pass cards one by one to each player?
and I want to ask you why did you choose not to create a Player class with it's own array of cards?