Return to site

Blackjack C Sharp

broken image


Best apple slot machine apps. Im tasked with developing a simple blackjack program for a class. Slot machines that you win real money. The program I have currently compiles and runs but it isnt paying out properly. A blackjack (21) should pay out 1.5*the wager, but it is doing it more than it should. Here is the code I have.

  1. C Sharp Programming
  2. C Sharp Download
  3. Blackjack C Sharp Piano

I know the problem is in my if else statements im just not sure how to make it work. Thanks for the help.

  • 3 Contributors
  • forum3 Replies
  • 4,671 Views
  • 7 Hours Discussion Span
  • commentLatest PostLatest Postby spookyfish
Sharp

Recommended Answers

$ begingroup $ @RubberDuck, there are single deck Blackjack games still being played in Deadwood,SD at Saloon #10 I think it might be the only single deck game in Deadwood. (Last Time I was there to Play Blackjack) $ endgroup $ – Malachi ♦ Aug 21 '14 at 15:09. In future, I will try to make some step-by-step video and techniques needed to develop this BlackJack game from ground. Give a comment below if this solution works for you or if you have a better.

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they …

Jump to Post

All 3 Replies

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they are, but for now just trust me.. you would think the above is correct, but there is a specific way that boolean tests are handled, either in a singular expression, or a stand-alone variable (which yeilds true or false, non-zero and zero respectively)

So, keep in mind, boolean logic is handled individually per expression, or as a stand alone TRUE/FALSE flag.

spookyfishcommented:Helped me solve my problem really quickly!+0
Blackjack C Sharp

This application uses one instance of the Random() class in the object rnd. It also allocates enough space to hold the totals for scores 3.18 in the array Rolls[]. MemberfunctionsOneDice() returns a value between 1 and 6 - rnd.Next(n) returns values in the range 0.n-1, while ThreeDice() calls OneDice() three times. The constructor for the RollDice() clears the Rolls array then calls ThreeDice() however many times (10 million in this case) and increments the appropriate Rolls[] element.

The last part is to print out the generated totals to see that it generates throws in accordance with the probabilities. A 6 sided dice has an average score of 3.5, so three dice should average about 10.5. The totals for 10 and 11 are roughly the same and occur about 12.5% of the time.

C Sharp Programming

Here is the output of a typical run. It takes no more than a second. Because it's a console application, I included a

Sharp

To wait until you hit a key before closing.

Blackjack

Recommended Answers

$ begingroup $ @RubberDuck, there are single deck Blackjack games still being played in Deadwood,SD at Saloon #10 I think it might be the only single deck game in Deadwood. (Last Time I was there to Play Blackjack) $ endgroup $ – Malachi ♦ Aug 21 '14 at 15:09. In future, I will try to make some step-by-step video and techniques needed to develop this BlackJack game from ground. Give a comment below if this solution works for you or if you have a better.

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they …

Jump to Post

All 3 Replies

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they are, but for now just trust me.. you would think the above is correct, but there is a specific way that boolean tests are handled, either in a singular expression, or a stand-alone variable (which yeilds true or false, non-zero and zero respectively)

So, keep in mind, boolean logic is handled individually per expression, or as a stand alone TRUE/FALSE flag.

spookyfishcommented:Helped me solve my problem really quickly!+0

This application uses one instance of the Random() class in the object rnd. It also allocates enough space to hold the totals for scores 3.18 in the array Rolls[]. MemberfunctionsOneDice() returns a value between 1 and 6 - rnd.Next(n) returns values in the range 0.n-1, while ThreeDice() calls OneDice() three times. The constructor for the RollDice() clears the Rolls array then calls ThreeDice() however many times (10 million in this case) and increments the appropriate Rolls[] element.

The last part is to print out the generated totals to see that it generates throws in accordance with the probabilities. A 6 sided dice has an average score of 3.5, so three dice should average about 10.5. The totals for 10 and 11 are roughly the same and occur about 12.5% of the time.

C Sharp Programming

Here is the output of a typical run. It takes no more than a second. Because it's a console application, I included a

To wait until you hit a key before closing.

C Sharp Download

Program Output

Blackjack C Sharp Piano

Program Listing





broken image