Conversation
|
🌐 Preview URL: https://pr-295-frcsoftware.frcsoftware.workers.dev |
Spaceman113138
left a comment
There was a problem hiding this comment.
There is a bit of inconsistantcy as to if there is a period at the end of a sentance or not.
Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com>
Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com>
Spaceman113138
left a comment
There was a problem hiding this comment.
3rd times the charm
Co-authored-by: Spaceman 11 <135277197+Spaceman113138@users.noreply.github.com>
Co-authored-by: Sam Freund <samf.236@proton.me>
| for (int timer = 15; timer >= 0; timer--){ | ||
| if (timer <= 0 ){ | ||
| drivetrain.setThrottle(0); | ||
|
|
There was a problem hiding this comment.
is this extra line the result of spotless/prettify or is it accidental?
EdanThomton
left a comment
There was a problem hiding this comment.
There's some inconsistent formatting of variable names in the comments, but other than that it looks good to me!
|
|
||
| // First, create a for loop that has a new integer variable named | ||
| // `timer` that is set to 15. The for loop checks if `timer` is | ||
| // greater than or equal to 0 then it decreases timer by one |
There was a problem hiding this comment.
| // greater than or equal to 0 then it decreases timer by one | |
| // greater than or equal to 0, then it decreases `timer` by one |
|
|
||
| // First, create a for loop that has a new integer variable named | ||
| // `timer` that is set to 15. The for loop checks if `timer` is | ||
| // greater than or equal to 0 then it decreases timer by one |
There was a problem hiding this comment.
| // greater than or equal to 0 then it decreases timer by one | |
| // greater than or equal to 0, then it decreases `timer` by one |
|
|
||
| // Create a for loop that has a new integer variable named `timer` | ||
| // that is set to 15. Check for when timer is greater than or equal to 0, | ||
| // then decrease timer by one. |
There was a problem hiding this comment.
| // then decrease timer by one. | |
| // then decrease `timer` by one. |
| System.out.println("but yours did"); | ||
|
|
||
| // Create a for loop that has a new integer variable named `timer` | ||
| // that is set to 15. Check for when timer is greater than or equal to 0, |
There was a problem hiding this comment.
| // that is set to 15. Check for when timer is greater than or equal to 0, | |
| // that is set to 15. Check for when `timer` is greater than or equal to 0, |
| void main() { | ||
|
|
||
| // First, create a new integer variable named `error` | ||
| // Below, create a while loop that compares if error is less than 5 |
There was a problem hiding this comment.
| // Below, create a while loop that compares if error is less than 5 | |
| // Below, create a while loop that checks if `error` is less than 5 |
| // First, create a new integer variable named `error` | ||
| // Below, create a while loop that compares if error is less than 5 | ||
| // if that is true, print "Robots should not quit", then increase `error` by one | ||
| // if error is no longer less than 5, print "but yours did" |
There was a problem hiding this comment.
| // if error is no longer less than 5, print "but yours did" | |
| // when `error` is no longer less than 5, print "but yours did" |
|
|
||
|
|
||
| // Create a for loop that has a new integer variable named `timer` | ||
| // that is set to 15. Check for when timer is greater than or equal to 0, |
There was a problem hiding this comment.
| // that is set to 15. Check for when timer is greater than or equal to 0, | |
| // that is set to 15. Check for when `timer` is greater than or equal to 0, |
|
|
||
| // Create a for loop that has a new integer variable named `timer` | ||
| // that is set to 15. Check for when timer is greater than or equal to 0, | ||
| // then decrease timer by one. |
There was a problem hiding this comment.
| // then decrease timer by one. | |
| // then decrease `timer` by one. |
| // First, create a for loop that has a new integer variable named | ||
| // `timer` that is set to 15. The for loop checks if `timer` is | ||
| // greater than or equal to 0 then it decreases timer by one | ||
| // Inside the for loop, have an if statement that checks if timer |
There was a problem hiding this comment.
| // Inside the for loop, have an if statement that checks if timer | |
| // Inside the for loop, have an if statement that checks if `timer` |
| // greater than or equal to 0 then it decreases timer by one | ||
| // Inside the for loop, have an if statement that checks if timer | ||
| // is less than or equal to 0. If so, set the drivetrain speed to 0 | ||
| // If the timer is less than or equal to 15, set the speed to one |
There was a problem hiding this comment.
| // If the timer is less than or equal to 15, set the speed to one | |
| // If the `timer` is less than or equal to 15, set the speed to one |
|
|
||
| class Drivetrain { | ||
| /** | ||
| * Dummy function that spins drivetrain motors at the specified speed. |
There was a problem hiding this comment.
| * Dummy function that spins drivetrain motors at the specified speed. | |
| * Mock function to simulate running drivetrain motors at specified throttle |
It's probably best to use throttle as the variable name
| // if that is true, print "Robots should not quit", then increase `error` by one | ||
| // if error is no longer less than 5, print "but yours did" |
There was a problem hiding this comment.
This example is funny to us, but might be confusing and not very intuitive what the students should be trying to accomplish with this loop. What if we made a more realistic scenario like:
A robot gyro must be calibrated before using it. Calibrating is done by printing "Calibrating..." to the console 5 times. Using a while loop and an integer, calibrate the gyro, then print "Calibration successful"
Description
What changed?
Why? (the code + comments should speak for itself on the "how")
Exercises.
Any issues this pull request closes or pull requests this supersedes should be linked with Closes #289 .
Meta
Merge checklist: