<center>

<div id="box">
</div>

<br />

<?
    
include('template/grille.php');
    
$fd = @fopen('/home/zeduel/logs/' $_GET['log'], 'r') or exit("impossible d'ouvrir le log !");
?>

<script language="javascript" type="text/javascript">
var grilles = new Array();
var coups   = new Array();
var tour = 0;

<?    
    $joueurs 
explode('_'$_GET['log']);
    
    for (
$x 0$x constant('COTE'); $x++) for ($y 0$y constant('COTE'); $y++) $grille[$x][$y] = 0;
    
    
$joueur 2;
    
$tour 0;    
    
    print 
"grilles[$tour] = '";
    
affiche($grille0);
    print 
"';\n";
    print 
"coups[0] = '';\n";
    
    while (
fscanf($fd"%d%c"$rangee$direction) > 0)
    {
        
$tour++;
        
$joueur autre($joueur);
        if ((
$grille joue($grille$rangee$direction$joueur)) != 0)
        {
            print 
"grilles[$tour] = '";
            
affiche($grille0);
            print 
"';\n";
        }
        else print 
"grilles[$tour] = 'Coup invalide !';\n";
        print 
"coups[$tour] = '$rangee$direction';\n";
    }
    
    
fclose($fd);
    
    print 
"var max = $tour;\n";
?>

function affiche(delta)
{
    tour += delta;
    if (tour < 0) tour = 0;
    if (tour > max) tour = max;
    document.getElementById('box').innerHTML = 
        '<b><span style="color: blue"><?= $joueurs[0?></span> vs <span style="color: red" ><?= $joueurs[1?></span> - ' +
        'tour : ' + tour + ' - ' +
        'coup : <span style="color: ' + (tour % 2 ? 'blue' : 'red') + '">' + coups[tour] + '</span>' +
        '<br /><br />' +
        grilles[tour] +
        '</b>';
}

affiche(0);

</script>

<table class="bar">
    <tr>
        <td width="40" align="center">
            <a href="#" onclick="affiche(-999); return false;">|&lt;</a>
        </td>
        <td width="40" align="center">
            <a href="#" onclick="affiche(-10); return false;">&lt;&lt;</a>
        </td>
        <td width="40" align="center">
            <a href="#" onclick="affiche(-1); return false;">&lt;</a>
        </td>
        <td width="40" align="center">
            <a href="#" onclick="affiche(+1); return false;">&gt;</a>
        </td>
        <td width="40" align="center">
            <a href="#" onclick="affiche(+10); return false;">&gt;&gt;</a>
        </td>
        <td width="40" align="center">
            <a href="#" onclick="affiche(+999); return false;">&gt;|</a>
        </td>
    </tr>
</table>

</center>