Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistency between Need for Speed task 6 analyzer feedback and instructions #2737

Closed
kahgoh opened this issue Feb 25, 2024 · 1 comment · Fixed by #2738
Closed

Inconsistency between Need for Speed task 6 analyzer feedback and instructions #2737

kahgoh opened this issue Feb 25, 2024 · 1 comment · Fixed by #2738
Assignees
Labels
x:size/small Small amount of work x:status/claimed Someone is working on this issue

Comments

@kahgoh
Copy link
Member

kahgoh commented Feb 25, 2024

I think the Need for Speed's task 6's instruction is out of sync with the analyzer feedback. More specifically, I think it is this one:

Instead of using a loop, consider returning a single expression using the <= operator. You can re-use the other methods already implemented in the class.

The part of the solution that produces this:

class RaceTrack {
    // ...
    public boolean tryFinishTrack(NeedForSpeed car) {
        while (!car.batteryDrained() && car.distanceDriven() <= this.distance){
            car.drive();
        }
        return car.distanceDriven() >= this.distance;
    }
}

The exemplar solution uses a mathematical formula in tryFinishTrack:

public boolean tryFinishTrack(NeedForSpeed car) {
    throw new UnsupportedOperationException("Please implement the RaceTrack.tryFinishTrack() method");
}

I no longer get the analyzer feedback when I change to this implementation. But, I think this is inconsistent with the current instructions, as I think it encourages students to continually call drive as per the while loop approach:

6. Check if a remote control car can finish a race

To finish a race, a car has to be able to drive the race's distance. This means not draining its battery before having crossed the finish line. Implement the RaceTrack.tryFinishTrack() method that takes a NeedForSpeed instance as its parameter and returns true if the car can finish the race; otherwise, return false. To see if the car can finish the race, you should try to drive the car until either you reach the end of the track or the battery drains:

Also, note the first point in the hints for task 6:

Check if a remote control car can finish a race

  • Solving this is probably best done by repeatedly driving the car.
  • Remember that the car has a method to retrieve the distance it has driven.
  • Consider what to do when the battery has been drained before reaching the finish line.
@kahgoh kahgoh changed the title Need for Speed task 6 doesn't match analyzer feedback Inconsistency between Need for Speed task 6 analyzer feedback and instructions Feb 25, 2024
@manumafe98
Copy link
Contributor

Hey @kahgoh thanks for opening an issue, you're right, we modified the reference resolution and built the analyzer so the students try to solve it without using a loop but forgot to change the instructions and hints, if you want to open a PR to fix this, go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/small Small amount of work x:status/claimed Someone is working on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants