From the course: Programming Foundations: Test-Driven Development
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
✓ Challenge: Performance - Java Tutorial
From the course: Programming Foundations: Test-Driven Development
✓ Challenge: Performance
(upbeat music) - So we figured out how to fetch a word from the word source and how to get the next clue based on the player's input. - Well now we need to think about updating the number of remaining trials in each round and calculating the score after each input. - So that means that we have two variables to be tested in each round. One, remaining trials, and two, the score. Now, testing trials should be easy because it should be reducing by one after each guess. Our max number of trials was 10, so we can define that as a constant. - And our scoring scheme is this formula. Score equals score plus max trials divided by word length. - So we need to update remaining trials at each input, but only update the score when the input is correct. - I can think of these scenarios. One, before the player enters a guess. Two, after the player enters the first correct guess. Three, after the player enters a second correct guess. And finally, after the player enters an incorrect guess. - This is a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.