Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Blackjack Cards Question

$
0
0
Hello! So I'm working on a blackjack game. I know how to do all the components of it except one. How to make the cards. Blackjack has 52 cards, all a different number and suit. However, I can't think of a logical way to do this task, then make sure the same card is not played twice in one hand and its random every time. One possible solution I was thinking was using a 2D ArrayList. I believe I've seen it done before using that, I'm however not familiar with them. Another solution I was thinking, but didn't quite formulate completely was making 52 integers, each named a different suit and number and assigning them values 1-52. Then getting a random number between 1 and 52 and using that card. That idea was not completely thought through though and may not even be possible. If you have any ideas or pieces of advice on this matter it will be greatly appreciated. Thanks!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>