質問

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