Simple blackjack game in c#
Aug 24, · IPlayer's methods are called by the Game component to notify the player about events. Game Component. The Game component contains: PlayerStatus class - wrapper class for player; data such as current player's hand and current status are stored in this class to prevent cheating:) Game class - blackjack game logic and control/5(10). I have to alter this in order for more than one player to be available. Do I change something in the Player class? Or do I create a new class for all Players? I am on the right track? Here is the c. Oct 31, · HELP ME!!!!! im making a blackjack game for my computer programming class in high school. and i don't what the f#@$ im doing. so if anyone can help me or give me some pointers would be nice. the format is C#.
Subscribe to RSS
Here is the code so far:. A Deck of cards is not a blackjack game. PrintDeck , as shown, will not change. WriteLine "It's a draw! Linq; using System. Add Face. Home Questions Tags Users Unanswered.
Do I change something in the Player class? Or do I create a new class for all Players? I am on the right track? Here is the code so far:. Also try to seperate your class rather than having multiple internal classes. It makes an easier read and makes navigation easier. Learn more. I have created a Black Jack game in c for one player. How can I create it for two or more players?
Ask Question. Asked 4 years, 1 month ago. Active 4 years, 1 month ago. Viewed 4k times. Next 0, deck. Value, card. WriteLine "Bust! WriteLine "Draw! WriteLine "It's a draw! Write "Please enter your name: " ; player. Write "Please enter a name for the dealer: " ; dealer. Write "Hit or Stick? WriteLine ; Console. Write "Do you want to play again? Leighton Blackburn Leighton Blackburn 11 1 1 silver badge 3 3 bronze badges. Is this your homework? It's an extension task.
My homework was to do the 5 card trick, so I wanted to do something trickier. Tomaltach Tomaltach 7 7 silver badges 23 23 bronze badges. What do you mean by separate my class? Add a new class in the project. Look at the updated answer. It will make each file smaller and to the point. The Player class will have all the properties the player should have.
You should use the Card object initializer to set Value too. Using Math. Min , that could look like this:. This looks like you don't want List , you want Stack. With that, all this code would simplify to:. What's the logic behind this? Why are you accepting strings like 10 0? And if you did intend that, what's the reason for that Trim?
Replace will already remove all spaces, including those at the start and end of the string and I don't think any other whitespace characters which is what the parameterless overload of Trim removes make sense here.
I don't think your logic for handling aces is sufficient. If I understand the rules correcty, even an ace that's not among the first two cards can be counted as 11 and even ace that is among the first two can be counted as 1. Don't leave commented out code from previous versions of your code behind. After you know the commented out code is no longer useful, remove it completely. You're already computing amountLost to display it, you should also use it to modify chips , since it will make your code more DRY:.
Both Deck and Hand overrides should take advantage of Card. I believe you understand the problem, there is no relation between your Face and Value. You should have a constructor for your Card class that would only take Suit and Face as parameters and you should calculate the Value. In this example I initialize the dictionary in the static constructor, which is called only once.
Мед. Spend that time in her company and learn just how powerful a woman's magic can be. they were porno's. defecated anywhere other than a bathroom, outhouse or any commonly accepted shit hole.