Rabu, 19 Maret 2014

Getting some tough problems here...about the blackjack.

So, because I was confused at doing my college task, I tried to search for some clues to finish the task.

And then I found a good web to finish it. It gives me almost all of my solution for the task.

So it gives me a full blackjack, that includes the betting system that counts the money that you are having.

The first lines of the program shows the menu, and the verification of the input for the first menu (start the game and exit the game)

The next lines shows the algorithms to draw the card, and how the program gets the hands (spade, diamond, club or hearts)

The play function runs the game,generates the card that the computer and the player gets.

The program verifies if the player gets the total hand of 21, the player wins. If the hand is less than 21, the program asks the player to draw another card or not.

If the dealer's hand reach 21 after the next draw, the player lose the bet, but if the dealer's hand is more than 21, you will win.

If the dealer and the player haven't reach 21 yet, the program will loop to ask for another draw.

The dealer function is used for the dealer's hand.

As the rules, if the player or the dealer draws an "Ace" the score can be different. If the total of the hand is less than 10, the program will give the score of the "ace" as 11. If the total is more than 10, it will only count as 1.

You will win if your hand's score is bigger than the dealer, as long as it isn't 21.

After the program exits, the program will print the result in a file about your game statistics. The program keeps the statistics of how many times you have won and lost.





And so, I learned some lessons here that my skills weren't very good enough to make even a simple program. It is quite a tough experience for me...

binus.ac.id