문제

I am making a card game in java/android. The idea is simple, a random card gets picked and shown and the player has to select if the next card is going to be higher or lower. My question is how can I make it so that once a card is selected it cant be used anymore?

My plan was to create an array 0-51; then do a switch and case for all the possibilities.

도움이 되었습니까?

해결책

That would work. Think of your array like a stack of cards and shuffle it. Then just go through the array, starting at 0, to pick cards off the top.

http://www.exampledepot.com/egs/java.util/coll_Shuffle.html

If you want to be super cool, use a Stack as the container for your cards, since that is most similar to how a real deck of cards operates.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top