Exercise Thursday

Goal: Wrap up your final day of in-class pair-programming strong, by solidifying the wide variety of concepts we've learned this week, and preparing for your first Java code review tomorrow!

Warm Up

  • So, what is Gradle actually doing in our projects anyway? What's a Gradle dependency?
  • Why might we opt not to include some files in our GitHub repositories by ignoring them?
  • What does the "Project is in a polished, portfolio-quality state" code review objective refer to? Discuss ideas for ensuring your future projects are portfolio-ready with your partner.


Choose Your Own Adventure

Create a command line application that allows users to play a text-based "choose your own adventure" style game. The game may be built around any theme you choose (ie: Surviving a zombie attack, successfully making it to a burrito food cart across town before it closes, getting to Epicodus on time in the morning, etc.)

Begin by presenting the user with a scenario (For instance: "You're walking along a path, when there's a fork in the road. You must choose to go either left or right. Which direction do you walk?"). Then, offer different subsequent scenarios depending on the user's response.

Repeat this process until you have many different gameplay possibilities and multiple potential endings. The user should have to make their way through many different decisions and scenarios, before they either win by reaching the game's goal (ie: Surviving that zombie attack, or making it to Epicodus before 8), or lose by not meeting that goal. Offer users the chance to start the game over when they lose.

Pig Dice or Tic-Tac-Toe

Yesterday, we offered Pig Dice and/or Tic-Tac-Toe as an in-class assignment. If you and your partner didn't get an opportunity to complete this application yesterday, do so now. If you did complete this application yesterday, either tackle the game you didn't create (Tic-tac-toe if you made Pig Dice yesterday, or vis versa), or move on to the (more challenging) Blackjack project below.

Here's the Pig Dice/Tic-Tac-Toe project prompt from yesterday:

In the last week of your Intro to Programming course, you created either a Pig Dice or Tic-Tac-Toe game.

Recreate one of these as a command line interface game in Java (consider tackling the project you didn't complete in Intro). Make sure to follow the "Red, Green, Refactor" BDD workflow throughout the course of development.

Blackjack (Challenging)

If you finish the previous exercise, including all further exploration objectives, create a command line application to play the game blackjack (also known as 'twenty-one'). If you're unfamiliar with the rules of this game, take a peek at the Wikipedia article.

In-Class Lesson

Before you begin, make sure to read through the following lesson from tonight's homework:


  • First, create a basic application that uses a nested loop to construct a "deck" of cards.
  • After that, add functionality that will randomly provide the user with two cards from the deck.
  • Then, integrate an option that allows the user to request to be dealt yet another card.
  • Eventually, add code to inform a user how close they are to 21; or, if they're over 21, inform them that they've lost the game.
  • If you're able to get all the behaviors above functioning, work on creating game modes where a user may play against the computer, and/or another player.
  • As always, write a test before implementing each new behavior. Continue to keep this lesson open as reference, if necessary.

Peer Code Review

  • Tests have complete coverage for all behaviors.
  • All tests are formatted correctly and pass.
  • Classes are encapsulated and getter methods are used to access properties.
  • Logic is well-refactored and easy to understand.
  • A .gitignore file keeps build files out of repo.
  • Code and Git documentation follows best practices.