src/arasanx.cpp
//
// Check for user move, resign or result in pending stack.
// If found, return (1 if user move, 2 if game end command)
// and do not dequeue command. Otherwise return 0.
//
Check for user move, resign or result in pending stack.
If found, return (1 if user move, 2 if game end command)
and do not dequeue command. Otherwise return 0.
Check for user move resign or result in pending stack . If found return ( 1 if user move 2 if game end command ) and do not dequeue command . Otherwise return 0 .
static int check_pending(Board &board) {
    if (doTrace) cout << "# in check_pending" << endl;
    int retVal = 0;
    Lock(input_lock);
    while (!pending.empty()) {
        const string cmd = pending.front();
        string cmd_word, cmd_args;
        split_cmd(cmd,cmd_word,cmd_args);
        if (cmd == "result" ||
            cmd == "new" ||
            cmd == "quit" ||
            cmd == "resign") {
                if (doTrace) cout << "# game end signal in pending stack" << endl;
                retVal = 1;                                
                break;
        }
        else if (cmd_word == "usermove" || text_to_move(board,cmd) != NullMove) {
            if (doTrace) cout << "# move in pending stack" << endl;
            retVal = 2;
            break;
        }
        else {                                      
#ifdef UCI_LOG
            ucilog << "calling do_command from check_pending" << (flush) << endl;
#endif
            if (doTrace) cout << "# calling do_command from check_pending" << (flush) << endl;
            if (doTrace) cout << "# removing " << cmd << endl;
            pending.pop_front();
            Unlock(input_lock);
            do_command(cmd,board);
            Lock(input_lock);
        }
    }
    Unlock(input_lock);
    return retVal;
}
static int check_pending ( Board & board ) { if ( doTrace ) cout << " " << endl ; int retVal = 0 ; Lock ( input_lock ) ; while ( ! pending . empty ( ) ) { const string cmd = pending . front ( ) ; string cmd_word , cmd_args ; split_cmd ( cmd , cmd_word , cmd_args ) ; if ( cmd == " " || cmd == " " || cmd == " " || cmd == " " ) { if ( doTrace ) cout << " " << endl ; retVal = 1 ; break ; } else if ( cmd_word == " " || text_to_move ( board , cmd ) != NullMove ) { if ( doTrace ) cout << " " << endl ; retVal = 2 ; break ; } else { #ifdef UCI_LOG ucilog << " " << ( flush ) << endl ; #endif if ( doTrace ) cout << " " << ( flush ) << endl ; if ( doTrace ) cout << " " << cmd << endl ; pending . pop_front ( ) ; Unlock ( input_lock ) ; do_command ( cmd , board ) ; Lock ( input_lock ) ; } } Unlock ( input_lock ) ; return retVal ; }
Check for user move, resign or result in pending stack.
Check for user move resign or result in pending stack .
// game end // might as well execute this // dequeue command // execute command