Advanced Project Exercises

4.8 (Blackjack App) Create a Blackjack card game app. Two cards each are dealt to the dealer and the player. (We provide card images with the book’s examples.) The player’s cards are dealt face up. Only the dealer’s first card is dealt face up. Each card has a value. A card numbered 2 through 10 is worth its face value. Jacks, queens and kings each count as 10. Aces can count as 1 or 11—whichever value is more beneficial to the player. If the sum of the player’s two initial cards is 21 (that is, the player was dealt a card valued at 10 and an ace, which counts as 11 in this situation), the player has “blackjack” and the dealer’s face-down card is revealed. If the dealer does not have blackjack, the player immediately wins the game; otherwise, the hand is a “push” (that is, a tie) and no one wins the hand. If the player does not have blackjack, the player can begin taking additional cards one at a time. These cards are dealt face up, and the player decides when to stop taking cards. If the player “busts” (that is, the sum of the player’s cards exceeds 21), the game is over, and the player loses. When the player stands (stops taking cards), the dealer’s hidden card is revealed. If the dealer’s total is 16 or less, the dealer must take another card; otherwise, the dealer must stay. The dealer must continue to take cards until the sum of the dealer’s cards is greater than or equal to 17. If the dealer exceeds 21, the player wins. Otherwise, the hand with the higher point total wins. If the dealer and the player have the same point total, the game is a “push,” and no one wins. The GUI for this app can be built using ImageViews, TextViews and Buttons.

4.9 (Enhanced Blackjack App) Enhance the Blackjack app in Exercise 4.8 as follows:

a) Provide a betting mechanism that allows the player to start with $1000 and adds or subtracts from that value based on whether the user wins or loses a hand. If the player wins with a non-blackjack hand, the bet amount is added to the total. If the player wins with blackjack, 1.5 times the bet amount is added to the total. If the player loses the hand, the bet amount is subtracted from the total. The game ends when the user runs out of money.

b) Locate images of casino chips and use them to represent the bet amount on the screen.

c) Investigate Blackjack rules online and provide capabilities for “doubling down,” “surrendering” and other aspects of the game.

d) Some casinos use variations of the standard Blackjack rules. Provide options that allow the user to choose the rules under which the game should be played.

e) Some casinos use different numbers of decks of cards. Allow the user to choose how many decks should be used.

f) Allow the user to save the game’s state to continue at a later time.

4.10 (Other Card Game Apps) Investigate the rules for any card game of your choice online and implement the game as an app.

4.11 (Solitaire Card Game) Search the web for the rules to various solitaire card games. Choose the version of the game you like then implement it. (We provide card images with the book’s examples.)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.50.119