Fix my (Java) blackjack simulator?
Asking debugging questions
Making the game rules will be the hardest part by far, but even still, it's pretty easy if you assign cards 3 values and make them their own objects. From there, you're pretty much set, just write a crapload of checks for current cash and if someone's bust. So tell us your thoughts so far. We can't help unless we have some notion of what you're stuck on.
Did your assignment come with a picture of a two-person blackjack GUI, or does "this" just refer to the pictures at Wikipedia? Do you know how you want the game to look when it launches? Will some GUI ask for the number of players? Will the dealing be animated? How will the game look as soon as all the human players have their first two cards? Start with the card and deck objects and go from there.
Each deck will contain 52 cards, each with a value and a suit. You can use enums for these and loop through them to create a deck. Next, handle how the deck is stored and dealt from. I would use an ArrayList, but there are many ways you can do this.
Then start working in your game logic, and from there you can add in your Dealer logic. The GUI will be made with Swing most likely, so you'll need to read up on that. There are plenty of tutorials out there. You need to decide what objects are important here. The first one I might work on is a Deck, which is an array of 52 Cards, each of which has a suit and a "value" string "2", "K", "10". A Deck needs to be able to pop cards off and shuffle.
It might also make sense to have a "regenerate deck" option after every hand. Of course, most actual casinos play multiple decks at once. BlackJack consists of an ordered list of players, a special case Player called Dealer which obeys certain rules, and a Deck. You may decide that it makes sense to merge the Player and Hand objects since each Player has exactly one hand and the Player doesn't really provide any functionality.
You may want to move some logic out of main; for example, it might make more sense to have Dealer subclass Player and include logic for knowing when to hit or not. Maybe you could move some other logic into other methods within BlackJack. Players can have more than one hand, you can make more than one bet at a time and you can also double down.
Also, I know OP was just giving a small snippet, but there should be an array of Players to avoid duplicate code. The spec as given doesn't suggest that players can have multiple hands, and this version doesn't have gambling so there's no "double down. If this were a "real" design, I might create separate classes for Hand and Player, but here it seems unnecessary. This is ultra basic OOP and if you're struggling with it, you should really consider whether you're doing the right course.
The spec you've been given is very thorough and this is probably the most common OOP assignment available. There are countless examples of it online, countless tutorials etc. Yet you're here, posting the spec and had the gall to ask people for code in one of your comments. You really have to think whether you're cut out for this. It will only get harder. Programming and software development isn't for everyone, which is why there was fuck all doing it before it because in vogue of late.
A good description of the problem. Online casinos only had downloadable software for PC users. Mac and Linux players had to find alternative methods for playing blackjack online. They either had to setup a dual boot system or emulator.
The number of players on Mac computers has risen, so much so that online casinos cannot ignore them any longer. These games play from your browser, so anyone with internet access can play. Nearly every online casino offers Java or Flash based games nowadays. We realize that not everyone is tech savvy or has played at an online casino before. By the end you should be able to visit one of our recommend casinos and start playing blackjack within minutes.
Java is a programming language created by Sun Microsystems. This platform was created so that developers could create programs for any operating system without having to worry about compatibility. So long as the developer uses Java and the consumer has Java installed to their computer, the games will run. This special promotion is granted to all those spenders who like to risk high amounts of money on the initial bets. That is why the casinos will give such type of players the access to more attractive casino bonuses.
You may fully appreciate the free chips without the need to uptake any action towards the wagering which will not be required of you. Thrills is one of the best casinos powered by Netent software. Top 10 Online Casinos. Default Title Date Random.
Casino Of The Month. GDay Casino Visit GDay Casino Gday Casino is an incredibly Australian gambling site that has prepared a special offer for the customers … Read More Slots Village Visit Slots Village The casino found under the Slots Village banner comes with a resourceful gambling platform that creates a … Read More Winward Visit Winward Once the WinWard Casino comes to appear within the browser, the viewers would find many games that are … Read More 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37