i want to shuffle to deck before it is distributed to the player at the start of the game so they dont end up with the same card over and over..
could you help?
oh and the top trumps are minecraft top trumps with the yogscast along with random mobs
and the numbers next to it are the ratings for that character, which are based in another class.
This is the code:
This method has some additional benefits: the deck is shuffled as the cards are dealt; the deck is restored (but shuffled), ready to be used again, simply by setting the sizeOfDeck to its original number, etc.
Jesper de Jong wrote:If you'd put the cards in a List instead of an array, then you could use Collections.shuffle(...) to shuffle the List.
yeah that would be a good idea, but i believe that it is easier in an array with the attributes of the toptrumps (the numbers after the characters)
like attack, block n stuff?
Jesper de Jong wrote:It wouldn't be a lot harder to put them in a List
ah ok i did it, thanks a lot
was very helpful
Jesper de Jong wrote:It wouldn't be a lot harder to put them in a List:
And, finally, I would make the Card an enum rather than a class. You may not have studied enums yet, so don't worry about it, but keep it in mind when you get there. I think a Card enum is an example in Oracle's tutorial too.
yeah i havent learnt about them yet, i will soon hopefully, i also havent learnt about images etc,
i want to be able to make the game actually a game instead of just lots of text!
i imported the 'import java.util.*;'
and then made it from the math part of that
here is the code:
thanks a lot for your ideas and help, i really appreciate it