ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

RedQueen 1.1.1 on Mac OS X
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Ben-Hur Carlos Langoni



Joined: 16 Oct 2008
Posts: 449
Location: Milky Way

PostPost subject: Re: RedQueen 1.1.1 on Mac OS X    Posted: Sat Mar 17, 2012 12:43 pm Reply to topic Reply with quote

lucasart wrote:

I tested your Linux 64-bit compile and got the same problem. So there must be something wrong in the code, and the problem is not linked to his mac compile. Things to look for:
* is the allocated time always less than the remaining time minus buffer ?
* how frequent is the polling code called ?


Hi Lucas,

This is the polling code:

Code:

const bool SimplePVSearch::stop(SearchInfo& info) {
   if ((agent->getSearchNodes()>0 &&
         agent->getSearcher(MAIN_THREAD)->getSearchedNodes() >= agent->getSearchNodes())) {
      return true;
   }
   if (timeIsUp() || agent->shouldStop()) {
      return true;
   }
   return info.splitPoint!=NULL && info.splitPoint->shouldStop;
}

...

// time is up?
inline const bool SimplePVSearch::timeIsUp() {
   if (searchFixedDepth ||
         infinite || (nodes & nodesToGo)) {
      return false;
   }
   return getTickCount()>=timeToStop;
}

...



The search initialization code:

Code:

// root search
void SimplePVSearch::search(Board board) {
   prepareToSearch();
   setStartTime(getTickCount());
   setTimeToStop();
   searchScore = idSearch(board);
   time = getTickCount()-getStartTime();
}


The frequency of the polling (based on the number of nodes processed):

Code:

nodesToGo = getTimeToSearch()<=1000?fastNodesToGo:defaultNodesToGo;

....
// constants
const int64_t defaultNodesToGo=0xFFF;
const int64_t fastNodesToGo=0xFF;
....



The problem is in the function that calculates the time to be used by search:
Code:

const int64_t SearchAgent::getTimeToSearch(const int64_t usedTime) {
   if (getSearchMode()==SearchAgent::SEARCH_MOVETIME) {
      return getMoveTime();
   }
   int64_t time=board.getSideToMove()==WHITE? getWhiteTime():getBlackTime();
   //int64_t incTime=board.getSideToMove()==WHITE?getWhiteIncrement():getBlackIncrement();
   int64_t movesLeft = defaultGameSize;
   time-=usedTime;
   if (movesToGo>0) {
      movesLeft = std::min(movesToGo,15);
      if (movesToGo<=2) {
         time=time*70/100;
      } else {
         time=time*99/100;
      }
   } else {
      for (int x=0;x<timeTableSize;x++) {
         if (time<timeTable[x][1] && time >= timeTable[x][2]) {
            movesLeft=timeTable[x][0]+
                  (maxGamePhase-board.getGamePhase())/2;
            break;
         }
      }
      time=time*97/100;
   }
   return time/movesLeft/*+incTime*/;
}


Commenting out the code (+incTime) above should "fix" the problem. But I am not sure what is the best approach for handling time control with increments...

Regards,
_________________
Ben-Hur Carlos Langoni Junior
http://sourceforge.net/projects/redqueenchess/
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Subject Author Date/Time
RedQueen 1.1.1 on Mac OS X Robert Purves Fri Mar 16, 2012 1:29 am
      Re: RedQueen 1.1.1 on Mac OS X Ben-Hur Carlos Langoni Fri Mar 16, 2012 7:53 pm
            Re: RedQueen 1.1.1 on Mac OS X Lucas Braesch Sat Mar 17, 2012 5:57 am
                  Re: RedQueen 1.1.1 on Mac OS X Ben-Hur Carlos Langoni Sat Mar 17, 2012 12:43 pm
                        Re: RedQueen 1.1.1 on Mac OS X Lucas Braesch Sat Mar 17, 2012 6:01 pm
                              Re: RedQueen 1.1.1 on Mac OS X Ben-Hur Carlos Langoni Sat Mar 17, 2012 6:19 pm
                                    Re: RedQueen 1.1.1 on Mac OS X Lucas Braesch Sun Mar 25, 2012 4:01 am
                                          Re: RedQueen 1.1.1 on Mac OS X Ben-Hur Carlos Langoni Mon Mar 26, 2012 2:30 pm
                                                Re: RedQueen 1.1.1 on Mac OS X Lucas Braesch Tue Mar 27, 2012 5:21 am
                                                      Re: RedQueen 1.1.1 on Mac OS X Ben-Hur Carlos Langoni Tue Mar 27, 2012 1:06 pm
                                                            Re: RedQueen 1.1.1 on Mac OS X Lucas Braesch Sun Apr 01, 2012 11:51 am
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads