Example #1
0
function mobile_get_full_game_update()
{
    if ($_GET['gameid'] != "") {
        $config = $Root_Path . "bin/config.php";
        $session = base64_decode($_GET['sid']);
        list($uniq, $player_id) = preg_split("/\\|/", $session);
        $oR3DCQuery = new CR3DCQuery($config);
        ChessHelper::load_chess_game($_GET['gameid']);
        echo "<PGN>";
        echo ChessHelper::get_game_pgn();
        echo "</PGN>\n";
        $pieces = ChessHelper::get_captured_pieces();
        echo "<CAPTURED_BY_WHITE>" . join(', ', $pieces['white']) . "</CAPTURED_BY_WHITE>\n";
        echo "<CAPTURED_BY_BLACK>" . join(', ', $pieces['black']) . "</CAPTURED_BY_BLACK>\n";
        echo "<GAME_STATE>";
        echo ChessHelper::get_game_state();
        echo "</GAME_STATE>\n";
        echo "<GAME_RESULT>";
        echo ChessHelper::get_game_result();
        echo "</GAME_RESULT>\n";
        $isblack = $oR3DCQuery->IsPlayerBlack($config, $_GET['gameid'], $player_id);
        $isdraw = $oR3DCQuery->IsRequestDraw($config, $_GET['gameid'], $isblack);
        echo "<DRAWCODE>";
        echo $isdraw;
        echo "</DRAWCODE>\n";
        $timeinfo = ChessHelper::get_timing_info();
        $str = "<TIME_STARTED>" . $timeinfo['started'] . "</TIME_STARTED>";
        $str .= "<TIME_TYPE>" . $timeinfo['type'] . "</TIME_TYPE>";
        $str .= '<TIME_MODE>' . $timeinfo['mode'] . '</TIME_MODE>';
        if ($timeinfo['mode'] == 1) {
            $str .= '<TIME_W_LEFT>' . $timeinfo['w_time_left'] . '</TIME_W_LEFT>';
            $str .= '<TIME_B_LEFT>' . $timeinfo['b_time_left'] . '</TIME_B_LEFT>';
            $str .= '<TIME_W_ALLOWED>' . $timeinfo['w_time_allowed'] . '</TIME_W_ALLOWED>';
            $str .= '<TIME_B_ALLOWED>' . $timeinfo['b_time_allowed'] . '</TIME_B_ALLOWED>';
        } else {
            $str .= "<TIME_DURATION>" . $timeinfo['duration'] . "</TIME_DURATION>";
            $str .= '<TIME_W_ALLOWED>' . $timeinfo['duration'] . '</TIME_W_ALLOWED>';
            $str .= '<TIME_B_ALLOWED>' . $timeinfo['duration'] . '</TIME_B_ALLOWED>';
        }
        echo $str;
    } else {
        echo "<ERROR>IDS_GAME_ID_INVALID</ERROR>\n";
    }
}
Example #2
0
<?php 
include $Root_Path . "includes/javascript.php";
?>

</head>
<body>

<center>
<textarea rows='27' cols='70' class='post'>
<?php 
//Instantiate the CR3DCQuery Class
// $oR3DCQuery = new CR3DCQuery($config);
// $PGN = $oR3DCQuery->SavePGN($config, $GID);
// $fen = $oR3DCQuery->GetActualFEN($sid, $GID); //GetFEN
// $oR3DCQuery->Close();
// unset($oR3DCQuery);
// echo $PGN;
CSession::initialise($config);
ChessHelper::load_chess_game($_GET['gid']);
echo ChessHelper::get_game_pgn();
?>
</textarea>
<br>
<input type='text' value='<?php 
echo $fen;
?>
' size='70'>
</center>

</body>
</html>
?>
 * 1000, move: <?php 
echo $conf['last_move_check_rate'];
?>
 * 1000, game_over: <?php 
echo $conf['last_move_check_rate'];
?>
 * 2000};
	
	settings['initial_game_state'] = "<?php 
include $Root_Path . "CChess2.php";
include $Root_Path . "CChessBoard.php";
include $Root_Path . "CChessBoardUtilities.php";
include $Root_Path . "CSession.php";
CSession::initialise($config);
ChessHelper::load_chess_game($gid);
$str = "<RESPONSE><PGN>";
$str .= ChessHelper::get_game_pgn();
$str .= "</PGN>\n";
$pieces = ChessHelper::get_captured_pieces();
$str .= "<CAPTURED_BY_WHITE>" . join(', ', $pieces['white']) . "</CAPTURED_BY_WHITE>\n";
$str .= "<CAPTURED_BY_BLACK>" . join(', ', $pieces['black']) . "</CAPTURED_BY_BLACK>\n";
$str .= "<GAME_STATE>";
$str .= ChessHelper::get_game_state();
$str .= "</GAME_STATE>\n";
$str .= "<GAME_RESULT>";
$str .= ChessHelper::get_game_result();
$str .= "</GAME_RESULT>\n";
$str .= "<DRAWCODE>";
$str .= $oR3DCQuery->IsRequestDraw($config, $_GET['gameid'], $player == 'black' ? TRUE : FALSE);
$str .= "</DRAWCODE>\n";
function process_game_values($data)
{
    $game_id = $data['instance']['game_id'];
    $data['instance']['board'] = $game_id;
    ChessHelper::load_chess_game($game_id);
    $ML = ChessHelper::$CB->GetMoveList();
    $moves_san = array();
    foreach ($ML as $move) {
        $moves_san[] = $move->szSAN;
    }
    //echo '<pre>';var_dump($moves_san);echo '</pre>';
    $fen = ChessHelper::get_custom_fen($game_id);
    $data['instance']['board'] = array('moves_san' => $moves_san, 'fen' => $fen);
    //exit();
}