Skip to content

Add Blackjack Outcome

Goal

Now that the outcome is more easily tested, add a new behavior where the Player wins Blackjack.

Predictive TDD

Review the predictive TDD cycle from here, which starts on slide 5.

TDD Blackjack Outcome

All Tests Pass

Make sure that all tests are passing before starting on this lab.

Using the Predictive Test-Driven Development technique, add new behavior for the player winning with Blackjack.

  • Blackjack is when the Player gets an initial deal of Ace and a card that has a value of 10, e.g., Ten, Jack, Queen, or King.

Run Tests Often

Make sure all of the tests pass after adding each tiny bit of behavior. Remember the TDD cycle: failing test (for the right reason), least effort to make it pass, and then refactor.

The new behavior is:

  1. The determineOutcome method on Game will need to return a new GameOutcome enum when the player wins with Blackjack.

  2. The isPlayerDone should be true when this happens.

Don't forget to Refactor, an important step in the TDD process.

Questions to Think About

  • Does Blackjack require the player to "hit"?

  • Should the player be allowed to hit or stand after getting Blackjack?


You are done!