static int isLegalRail(Game game,Location currentCity,Location lookingForCity,Location currentDepth,int maxDepth) { if (currentDepth>maxDepth) { return FALSE; } int reference = 0; while ((currentCity<=RAILBOUNDARY)&&(!isSea(lookingForCity))&&(currentDepth<=maxDepth)){ if(isConnectedRail(game,currentCity,reference)) { if (reference == lookingForCity) { return TRUE; } else { if(isLegalRail(game, reference, lookingForCity, currentDepth+1, maxDepth)){ return TRUE; } } } } return FALSE; }