$PHP_OUTPUT .= '<th>Log Type</th>';
    $container['item'] = 'sector_id';
    $PHP_OUTPUT .= create_link($container, '<th style="cursor:hand;">Sector</th>');
    $PHP_OUTPUT .= '<th>Message</th>';
    $PHP_OUTPUT .= '</tr>';
    $db->query('SELECT * FROM account_has_logs WHERE account_id IN (' . $account_list . ') AND log_type_id IN (' . $db->escapeArray($log_type_id_list) . ') ORDER BY ' . $var['item'] . ' ' . $var['order']);
    while ($db->nextRecord()) {
        $account_id = $db->getInt('account_id');
        $microtime = $db->getMicrotime('microtime');
        $message = stripslashes($db->getField('message'));
        $log_type_id = $db->getInt('log_type_id');
        $sector_id = $db->getInt('sector_id');
        // generate style string
        $style = ' style="color:' . $colors[$account_id] . ';"';
        $PHP_OUTPUT .= '<tr>';
        $PHP_OUTPUT .= '<td' . $style . '>' . date(DATE_FULL_SHORT, microtimeSec($microtime)) . ' ' . microtimeMSec($microtime) . 'us</td>';
        $db2->query('SELECT * FROM log_type WHERE log_type_id = ' . $db2->escapeNumber($log_type_id));
        if ($db2->nextRecord()) {
            $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $db2->getField('log_type_entry') . '</td>';
        } else {
            $PHP_OUTPUT .= '<td align="center"' . $style . '>unknown</td>';
        }
        $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $sector_id . '</td>';
        $PHP_OUTPUT .= '<td' . $style . '>' . $message . '</td>';
        $PHP_OUTPUT .= '</tr>';
    }
    $PHP_OUTPUT .= '</table>';
}
$PHP_OUTPUT .= '<p>';
$container = create_container('skeleton.php', 'log_console.php');
$container['account_ids'] = $account_ids;
Beispiel #2
0
     fputs($toEngine, $s . EOL);
     if ($read === true) {
         readFromEngine($block);
     }
 }
 readFromEngine();
 writeToEngine('uci');
 writeToEngine('setoption name Hash value ' . UCI_HASH_SIZE_MB, false);
 writeToEngine('isready');
 writeToEngine('ucinewgame', false);
 SmrSession::$game_id = NPC_GAME_ID;
 require_once get_file_loc('ChessGame.class.inc');
 while (true) {
     //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant).
     runkit_constant_redefine('MICRO_TIME', microtime());
     runkit_constant_redefine('TIME', (int) microtimeSec(MICRO_TIME));
     $chessGames =& ChessGame::getNPCMoveGames(true);
     foreach ($chessGames as &$chessGame) {
         debug('Looking at game: ' . $chessGame->getChessGameID());
         writeToEngine('position fen ' . $chessGame->getFENString(), false);
         writeToEngine('go ' . ($chessGame->getCurrentTurnColour() == ChessGame::PLAYER_WHITE ? 'w' : 'b') . 'time ' . UCI_TIME_PER_MOVE_MS, true, false);
         stream_set_blocking($fromEngine, 1);
         while (stripos($move = trim(fgets($fromEngine)), 'bestmove') !== 0) {
             debug('<-- ' . $move);
             if (stripos($move, 'Seg') === 0) {
                 // Segfault
                 debug('UCI engine segfaulted?');
                 exit;
             }
         }
         debug('Move info: ', $move);
Beispiel #3
0
function processContainer($container)
{
    global $forwardedContainer, $previousContainer, $player;
    if ($container == $previousContainer && $forwardedContainer['body'] != 'forces_attack.php') {
        debug('We are executing the same container twice?', array('ForwardedContainer' => $forwardedContainer, 'Container' => $container));
        if ($player->hasNewbieTurns() || $player->hasFederalProtection()) {
            // Only throw the exception if we have protection, otherwise let's hope that the NPC will be able to find its way to safety rather than dying in the open.
            throw new Exception('We are executing the same container twice?');
        }
    }
    clearCaches();
    //Clear caches of anything we have used for decision making before processing container and getting lock.
    $previousContainer = $container;
    debug('Executing container', $container);
    //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant.
    runkit_constant_redefine('MICRO_TIME', microtime());
    runkit_constant_redefine('TIME', (int) microtimeSec(MICRO_TIME));
    resetContainer($container);
    do_voodoo();
}