-
Notifications
You must be signed in to change notification settings - Fork 217
Description
Hello! Thank you for your efforts in open-sourcing Procgen. I wanted to bring to your attention an implementation bug that I have encountered.
In FruitBot, once the agent makes contact with the finish line, there is a possibility that COMPLETION_BONUS is awarded twice. This is because sometimes the agent makes contact with two PRESENT objects simultaneously, and the code that prevents multiple awards of COMPLETION_BONUS appears to have an implementation bug.
This code in handle_agent_collision appears to be the source of the issue:
} else if (obj->type == PRESENT) {
if (!step_data.done) {
}
step_data.reward += COMPLETION_BONUS;
step_data.done = true;
step_data.level_complete = true;
}
As you can see, no action is taken when (!step_data.done), which I believe is not intended. Therefore, multiple calls to handle_agent_collision when the agent simultaneously collides with multiple presents (usually 2) lead to multiple awards of COMPLETION_BONUS.
Based on my testing, I believe this fixes the issue and should be the correct implementation:
} else if (obj->type == PRESENT) {
if (!step_data.done) {
step_data.reward += COMPLETION_BONUS;
step_data.done = true;
step_data.level_complete = true;
}
}
Thank you! If it helps, I can make a PR if you have interest in merging in a fix.