Solucio escacs php

De wikiserver
Dreceres ràpides: navegació, cerca
<!DOCTYPE html>
<html>
    <head>
        <title>ESCACS</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <h3> TABLERO DE AJEDREZ DINÁMICO </h3>
        <table width="270px" cellspacing="0px" cellpadding="0px" border="1">
        <?php
            for($x=0; $x<9;$x++){
                echo "<tr>";
                for($i=0; $i<9;$i++){
                    /* Si es impar = 1 True por tanto blanco, primera casilla = 0 */
                    if(($x+$i)%2){
                        echo "<td height='30px' width='30px' bgcolor='black'></td>";
                    }
                    else{
                        echo "<td height='30px' width='30px' bgcolor='white'></td>";
                    }
                }
                echo "</tr>";
            }
        
        ?>
        </table>
    </body>
</html>

<?php

for ($i=0; $i <8 ; $i++) {

for ($j=0; $j <8 ; $j++) { if($j%2==0) { echo " * "; }else{ echo " * "; } } echo "
"; }

?>