Sprint 3

Roadmap:

  • Team assignments: Section A; Section B
  • Start: 2nd half of class, Thu 9/28
  • End: Quiz in 1st half of class, Thu 10/12
  • Requirements Due: beginning of class, Thu 10/12

Rationale:

Scrabble is a game in which you take a collection of letter tiles, attempt to form words with the tiles, and arrange the words on a game board in a fashion that mimics a crossword puzzle. Each letter tile in the game has a point value associated with it. Letters that rarely appear in words are worth more points (and further, there are few of these tiles). How do we know what the ideal point values and tile quantities are for the game?

The initial effort to answer this question was considerable. The basic idea is that we count up the number of appearances of the letters among all of the playable words and assign point values and tile quantities accordingly. We have almost all the tools we need to do this:

  • create an int variable for the letter a (simple)
  • put all the words into a single String variable (time-consuming, but easy)
  • call indexOf to find the first a, then the next a, then the next a… (we did this in the previous sprint)
  • … and so on until we reach the end of the String (oops! how do we do this?)

It turns out that this last type of step, repeating a process until something happens, is essential to computer programming, whether for something whimsical like designing a game or something critical, like determining all of the students who have met the requirements for graduation. In this sprint we learn about loops, the programming term for repeating a process as many times as we need to reach a particular goal.

Responsibilities (What you need to know):

  • (6.1) Understand the while syntax and be able to write a while loop
  • (6.1) Understand the similarities between the if syntax and while syntax
  • (6.1) Understand the order in which programming statements are evaluated during loop execution
  • (6.1) Understand the scope (the birth and death) of variables, particularly in looping structures
  • (6.1) Translate from thinking “keep going until x happens” to “keep going as long as x doesn’t happen”
  • (6.1) Understand the conditions under which an infinite loop can occur
  • (6.1) Understand and prevent the common error of a loop running 1 too many or 1 too few times
  • (6.2) Trace through loop code by hand and use paper to visualize and solve loop-oriented problems
  • (6.2) Use print and println statements to visualize the execution of a loop
  • (6.3) Understand the for syntax and be able to write for loops
  • (6.3) Be able to distinguish cases when a while loop is appropriate from cases when a for loop is appropriate
  • (6.3) Understand the order in which programming statements are evaluated during for loop execution
  • (6.3) Understand the scope (the birth and death) of variables, particularly in for loop structures
  • (6.7) Understand common loop algorithms and be able to apply them to the problem-solving process
    • Calculate the sum and average of a series of inputted numbers
    • Determine the minimum and maximum values of a series of inputted numbers
    • Compare the two most recently inputted items in a series of inputs (numbers, strings, etc.)
    • Count the number of occurrences of an item in a series of items (numbers, String characters, etc.)
    • Locate the first occurrence an an item in a series of items (numbers, String characters, etc.)
    • Prompt for a value until the value is in acceptable ranges
  • (6.10) Understand how to use the debugger to trace through code and look for “bugs” (mistakes)

Requirements (What you need to do):

Individual Requirements:

  • Understand the concepts on the Responsibilities list.

Team Requirements:

  • Complete the code in this project. All instructions are contained in the project comments.

Resources:

Learning Resources:

References:

Practice:

More information may be posted later; use expert requests to ask for additional materials

Reality Check:

In a traditional classroom we might adopt this schedule:

  • Homework for Tuesday: Read 6.1 - 6.3. Try warm ups.
  • Tuesday in class: Show examples of reading and writing loops. Work warm up together: Guessing game
  • Homework for Thursday: Read 6.7 & 6.10. Do "TwoDigit" and "Track words" HW problems.
  • Thursday in class: Go over common loop patterns, especially String problems. Work warm ups together: Input Tracker, Hashtags, For Loops
  • Homework for Tuesday: Do "Double Letter" and "Special Pattern" HW Problems
  • Tuesday: Practice & review for quiz.
  • Homework for Thursday: Practice and study!