CSA Unit 4, Lesson 2, Level 8 example is wrong

If you select the Rubik’s Cube solver exercise, it says you’re finding the fastest solver, but then requires the following:
/* ----------------------------------- TO DO -----------------------------------
* :white_check_mark: Check if the parameter time is greater than fastestTime. If this is true,
* update fastestTime to the value passed to the parameter time.
* -----------------------------------------------------------------------------
*/

This will result in fastestTime taking on the largest time, which for any regular definition of time means it’s the slowest. I used the example solver list and, sure enough, it picks the slowest, Tanzer, as the person with the “fastest time”.

The lesson lets me complete with this idea. Switching the initial value of fastestTime to 65535 and the comparison to the following:

if(fastestTime > time){
  fastestTime = time;
  System.out.println(Integer.toString(time));
}

results in the fastest time being selected (363 centiseconds), but the code fails the built-in tests because they expect the incorrect comparison to have been used.

Hi Travis,
Thank you for alerting the community to this issue! I agree that the wording is confusing, and that it is actually finding the slowest solver, since that is the longest time. Posting here will help other teachers to be aware of this issue as they plan. To alert the curriculum team with typos or similar errors, emailing support@code.org, or clicking on the rate the lesson button on the unit overview page will get the message to them.

Thank you,
Lindsay

1 Like

Lindsay, do I need to do that for this issue or has that already been handled through this post?

1 Like

Hi @codedotorg I have emailed support@code.org about this problem just now. If you wouldn’t mind sending an email as well I think that if multiple people report this issue then it gets up the priority stack. Thank you again for bringing this to the attention of the forum!

Best,
-Sam