For this project, you're going to create a small Blackjack game. We're going to use a simplified set of rules; you can try tackling the full set of rules as an advanced exercise if you want, once you're done with the basic task.

For our app, we're just going to use numbers from 1 to ­10 (no suits, no royals etc). The user can either Hit or Walk. Hit gives them another card (ie generates a random number from 1 to ­10). Walk allows them to step away and lock their score. If their score (sum of all the cards) ever crosses 21, they've gone Bust (ie they've lost). Allow them to restart the game when they've Walked or gone Bust.

Basic requirements

  • Buttons to Hit and Walk
  • UI should show the cards drawn so far (you can just use TextView to do this)
  • UI should show current total
  • Game should end when they either Walk or go Bust, and the result should be displayed
  • There should be a way to reset the game and start over

[DEMO]

Advanced tasks

These are presented in increasing order of complexity, I strongly recommend you do at least the first two.

  • Keep track of their average score so far (Bust counts as 0). Track the number of times they've gone Bust.
  • Support two players, so you can play against another human. Players take turns Hitting or Walking. The player with the higher number (and has not gone Bust) wins.
  • Make an AI second player to play against. This might be easier to do once you do the above task that allows a second human player to play.
  • Use an actual deck of cards instead of 1 to ­10. A counts as 1, KQJ count as 10.
  • Make sure cards can't repeat (if first card is a 2, another 2 can't come out)
  • Add suits (Ace, Diamond, Hearts, Spades) Improve the UI. Suggestions: Find card images to display. Use the suits emoji if you've added suits to the game.

results matching ""

    No results matching ""