예제 #1
0
	// function which is called to do the actual search
	virtual SearchResults search()
	{	
		searchTimer.start();
		
		// try to search since we throw exception on timeout
		try {
			DFBB(params.initialState, 0);
			
			results.timedOut = false;
		
		// if we catch a timeout exception
		} catch (int e) {
		
			// store that we timed out in the results
			results.timedOut = true;

			// for some reason MSVC++ complains 1about e being unused, so use it
			e = e + 1;
		}
		
		// set the results
		results.nodesExpanded = nodesExpanded;
		results.timeElapsed   = searchTimer.getElapsedTimeInMilliSec();
		
	    int skip = upperBound / buckets;
		
		for (int i=0; i<buckets; i++)
		{
		    if (armyValues[i] > 0)
		    {
		        int low = i * skip;
		
		        printf("%6d - %6d : %5d   ", low, low + skip, armyValues[i]);
		        for (size_t a=0; a<buildOrders[i].size(); ++a)
		        {
		            printf("%d ", buildOrders[i][buildOrders[i].size()-1-a]);
		        }
		        printf("\n");
		    }
		}
		
		printf("Transposition (Cuts = %d) (Collision = %d) (Found = %d) (NotFound = %d)\n", ttcuts, TT.numCollisions(), TT.numFound(), TT.numNotFound());
		
		return results;
	}