I need advice for recursion script for route searching

Hi, I am new to recursion scripting, and am trying to script route searching.

In normal situation it returns intersections.
bool viewLineToGoalIntersected = false;
for(int i = 0; i < interceptor.Count; i++){
var e1 = Rhino.Geometry.Intersect.Intersection.CurveCurve(viewLineToGoal, interceptor[i], 0, 0);
if(e1.Count > 0){
viewLineToGoalIntersected = true;
but in deep part of recursion, it doesn’t work.

If anyone know why, or better way to search route,
please advice me.
Thank you.

The attached .gh sometimes freeze your Rhino. (I do not know why)
please be careful.

unnamed.gh (10.3 KB)
Untitled.3dm (33.4 KB)

Maybe post in “script” section of this forum ?

thanks, ill move this.

I moved it to the scripting category although I’m not certain if it should be there since it’s scripting inside grasshopper…

Thanks, I didn’t know how to move.