Skip to content

Test-Driving Player Betting

Depends on Player Betting Code & Test

This lab requires the updated Game and GameBetPayoffTest classes that we worked on, so you can clone or download the latest code from the repository and start from there, or you can copy the Game.java and GameBetPayoffTest.java files from the source code repository and add them to your project.

Goal

Continue to add (to the Game class) the behaviors handling losing, pushing, and winning Blackjack, using the Predictive TDD cycle (with tests in the GameBetPayoffTest).

Run All Tests...

Make sure all the tests pass before you start.

Behaviors

  1. Player LOSES: The outcome is that the amount bet by the player is lost.

  2. Player PUSHES: The amount bet is returned to the player and added back to their balance.

  3. Player WINS BlackJack: The bet * 2.5 is added back to the player's balance.

Refactoring

What refactoring opportunities do you see? Are there any patterns of duplication or complexity that can be simplified?