Open sin3to1faith opened 4 months ago
Thanks for taking the time to give feedback. In this case, the lesson's correct. To move to the end of a grid of 5 cells, if you're on cell 1, you need to move 4 times. range(5) (the size of the array) would produce 5 numbers (0, 1, 2, 3, 4) and make you move 5 steps, so 1 cell past the limit. That's why you need to subtract 1 from the board size.
I'm changing the issue title to add a new sentence about that to the lesson.
if you're on cell 1
I'm guessing cell 1 refers to the 0
on y
in Vector2
? My apologies for the oversight. I assumed there was a "cell 0" and forgot that it was just an index.
Is it correct to presume that we can use range(board_size.x)
if the robot is not already on the board?
In the second example of this section's lesson,
board_size.x - 1
is used as a parameter in therange()
function when it should beboard_size.x
asvoid range(length: int)
creates a list of numbers from 0 to length - 1.This mistake can be seen again in the first practice lesson 'Using a for loop to move to the end of the board'. The user must recreate the mistake shown in this lesson's example to succeed in the practice lesson.