Rule 3.5.2 (page 14 in the rules) directly says
Robots must be constructed in a way that they do not enter the goal.
That formulation leaves some room for interpretation, so here is mine: if your robot does not enter the goal, it does not matter much how does it do that. If it enters the goal, however, that would mean it is not constructed in a way that prevents it from doing so. At that point it would be a violation of the rules.
To prevent any doubt, it may be easier to make it so that the robot is physically unable to enter the goal but doing so programatically (that is through programming) is also acceptable (if it works ).
Please let me know if this helps.