"Lesson 15 - Modulo" should be removed
This lesson is far too likely to confuse, overwhelm, and discourage beginners.
1 - Most people have never heard the term "modulo" before and they're used to the "%" symbol meaning "percent", which makes it more confusing to see it used for something other than that. This is also made more complicated by the fact that the term "modulo" seems to be used both to refer to a "modulo operation" and to the divisor (which in the lesson appears to sometimes be referred to as the "divisor" and sometimes as the "modulo").
2 - Why modulo does what it does in the lesson is never explained in simple terms. For example, with the traffic light there should have been some explanation along the lines of "Whenever the first number is lower than the second number the result will be the first number, and whenever both numbers are the same the result will be zero. Therefore, by incrementing light_index by 1 and giving it a starting value within the range of values we want it to have, setting light_index to the result of "light_index % [max value + 1]" insures that once it becomes greater than the maximum value we want it to be it will reset to be 0.
Similarly, the part about determining if a number is even or odd doesn't explain that the reason it works is because all even numbers are divisible by 2 with no remainder (thus the result being 0) and all odd numbers will have a remainder of 1 when divided by 2. The dice roll example also lacks a clear, beginner-friendly explanation of why it works.
3 - Even if clear explanations were given, using modulo is simply unnecessary in all of the practices. For a tutorial series to be friendly to beginners, unnecessary information should be avoided. Here, all three practices have a much simpler, more beginner-friendly alternative that would achieve the same result:
Advancing Traffic Lights: As the lesson shows, this can be done in a simpler, more readable way by simply using an if statement (which should have been "if light_index >= 3", not just "if light_index == 3") to control the value
Rolling Dice: No need for modulo to be used with randi here, just use randi_range
Bonus Health Every Other Level: This can be done simply using variables and if statements.
While modulo operations may be genuinely useful in some cases, for a beginner it's just not necessary. It's also, I think, likely to scare off some of the more math-averse people who are trying to learn to make games. If the lesson was revised to add the simple explanations of why the examples work, I would recommend still cutting it from the main series and maybe putting it into some sort of bonus section for trips and tricks - Something that would make it clear that the lesson is something that could be useful to learn about but isn't necessary and so it's not a big deal if someone doesn't understand it or want to use it.
EDIT: As one extra, very minor, nitpick, the end of the lesson says the practice will involve increasing the robot's max health every odd level but the practice says it'll be increased every even level.
At the very least I would have found it helpful for the light changing example to show the math at each step of the light change. I don't think the dice rolling example was explained well enough and I felt very unprepared for the dice rolling practice. When I look at the solution provided it is not what I expected and not what I entered to achieve a pass. Did you explain anywhere that you can do function in a return?
Here's me:
func roll_dice(sides): var result = randi() % sides + 1 return result
Here's solution:
return randi() % sides + 1
I read this issue before doing the lesson 15 and i thought: OP is probably exaggerating...
Then i did the lesson and got confused real fast. The traffic light exemple is indeed not explained enough. I had to go on stackoverflow to understand why having a smaller numerator works the way it does.
I don't mind being thought cool tricks, even if it's not the best for readability. However, if the goal is to teach beginners with no math experience, the exemples need more step by step explanations like OP and slipgatekid said.
I do not agree that the lesson should be completely removed. Modulo is a useful tool to have.
The issues #639 and #640 supersede this one. We're not planning to remove the lesson entirely. But thanks much for the feedback, we're aware that we have to move this lesson out of the main track, and improve visualizations and explanations.