All pastes #191869 Raw Edit

Stuff

public text v1 · immutable
·published 2006-10-05 13:19 UTC
rendered paste body
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;
}