Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1468 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  script de jeu solitaire

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

script de jeu solitaire

n°2021935
sultanb
aidons nous svp
Posté le 08-09-2010 à 18:47:01  profilanswer
 

bjrs a tous et merci pour tous les solutions que vous avez données, mais j'ai un nouveau problème.
j'ai réalisé un script de jeu solitaire en php mais lorsque je click sur nouvelle partie voici l'erreur qui s'affiche:*
Parse error: parse error in C:\Program Files\wamp\www\solitaire.php on line 569
 
voilà mon script php pour analyse:
 
<?php
function iniJeux() {
 for ($x=1;$x<=4;$x++) {
   for ($y=1;$y<=13;$y++) {
     $t[]= array($y,$x);
   }
 }
    return $t;
}
 
function iniPlateau($t){
   $cpt=0;
   for ($x=0;$x<count($t);$x++) {
     $cpt++;
  $cpt=($cpt==9?1:$cpt);
  $t_ret[]= array($cpt,$t[$x][0],$t[$x][1]);
   }
   return $t_ret;
}
 
function rempliCol($t,$col) {
   for ($x=0;$x<count($t);$x++) {
     if ($t[$x][0]==$col) {
    $t_ret[]=array($t[$x][1],$t[$x][2]);
  }  
   }
   return $t_ret;
}
 
function chargeCol($col) {
 $t= explode(",", $col);
 //echo "<br><br>chargeCol $col <br>";
 for($x=0;$x<count($t);$x++) {
   $val=substr($t[$x],0,(strlen($t[$x])-1)) ;
   $color=substr($t[$x],-1);
   $t_ret[]= array($val,$color);
   //echo "$val : $color,";
 }
 return $t_ret;
}
 
 
function dechargeCol($t) {
 $ret="";
 for($x=0;$x<count($t);$x++) {
  $ret.=($x>0?",":"" );
  $ret.=trim($t[$x][0]).trim($t[$x][1]);
 }
 $ret=(trim($ret)==""?"00":$ret);
 return $ret;
}
 
function depile($zone) {
 global $t_col1,$t_col2,$t_col3,$t_col4,$t_col5,$t_col6,$t_col7,$t_col8;
 global $tres11,$tres12,$tres13,$tres14;
 switch ($zone) {
  case 1: $t_ret=array_pop($t_col1); break;
  case 2: $t_ret=array_pop($t_col2); break;
  case 3: $t_ret=array_pop($t_col3); break;
  case 4: $t_ret=array_pop($t_col4); break;
  case 5: $t_ret=array_pop($t_col5); break;
  case 6: $t_ret=array_pop($t_col6); break;
  case 7: $t_ret=array_pop($t_col7); break;
  case 8: $t_ret=array_pop($t_col8); break;  
  case 11: $t_ret=$tres11; $tres11=array(0,0); break;  
  case 12: $t_ret=$tres12; $tres12=array(0,0); break;  
  case 13: $t_ret=$tres13; $tres13=array(0,0); break;  
  case 14: $t_ret=$tres14; $tres14=array(0,0); break;  
     
 }
 return $t_ret;
}
 
function empile($zone,$carte) {
 global $t_col1,$t_col2,$t_col3,$t_col4,$t_col5,$t_col6,$t_col7,$t_col8;
 global $tres11,$tres12,$tres13,$tres14;
 global $tas21,$tas22,$tas23,$tas24;
 switch ($zone) {
  case 1: $b=($t_col1[0][0]==0?array_pop($t_col1):0);$t_col1[]=$carte; break;
  case 2: $b=($t_col2[0][0]==0?array_pop($t_col2):0);$t_col2[]=$carte; break;
  case 3: $b=($t_col3[0][0]==0?array_pop($t_col3):0);$t_col3[]=$carte; break;
  case 4: $b=($t_col4[0][0]==0?array_pop($t_col4):0);$t_col4[]=$carte; break;
  case 5: $b=($t_col5[0][0]==0?array_pop($t_col5):0);$t_col5[]=$carte; break;
  case 6: $b=($t_col6[0][0]==0?array_pop($t_col6):0);$t_col6[]=$carte; break;
  case 7: $b=($t_col7[0][0]==0?array_pop($t_col7):0);$t_col7[]=$carte; break;
  case 8: $b=($t_col8[0][0]==0?array_pop($t_col8):0);$t_col8[]=$carte; break;
  case 11 : $tres11=$carte; break;  
  case 12 : $tres12=$carte;  break;
  case 13 : $tres13=$carte;  break;
  case 14 : $tres14=$carte;  break;
 
  case 21 : $tas21=$carte;  break;
  case 22 : $tas22=$carte;  break;
  case 23 : $tas23=$carte;  break;
  case 24 : $tas24=$carte;  break;
 }
}
//convertisseur graphique des valeurs du tableau
function conv2carte($val,$color){
  if ($val==11) {$convVal="V";}
  elseif ($val==12) {$convVal="D";}
  elseif ($val==13) {$convVal="R";}
  elseif ($val==1) {$convVal="A";}
  else {$convVal=$val;}
   
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  if ($color>=3) {$debfont="<font color=\"#FF0000\">";  $finfont="</font>";}
  else           {$debfont="";  $finfont="";}
   
  return $debfont."&nbsp;".$convVal." ".$finfont."<img src=\"images/".$convColor.".gif\" width=\"11\" height=\"11\">";  
   
}
function conv2carte_b($val,$color){
  if ($val==11) {$convVal="V";}
  elseif ($val==12) {$convVal="D";}
  elseif ($val==13) {$convVal="R";}
  elseif ($val==1) {$convVal="A";}
  else {$convVal=$val;}
   
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  if ($color>=3) {$debfont="<font color=\"#FF0000\">";  $finfont="</font>";}
  else           {$debfont="";  $finfont="";}
   
  return "<img src=\"images/".$convColor.".gif\" width=\"11\" height=\"11\">".$debfont." ".$convVal."&nbsp;".$finfont;  
   
}
 
function convFigure($val,$color){
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  $ret="";
  if ($val<=6) {
     if ($val==1) {
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";    
  } elseif($val==2){
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
  } elseif($val==3) {
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
  } elseif($val==4){
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";    
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
  } elseif($val==5){
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
  } else {
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images/m_".$convColor.".gif' width='16' height='25' ><img src='images/m_vide.gif' width='16' height='25' ><img src='images/m_".$convColor.".gif' width='16' height='25' ></div>";
  }  
  } elseif ($val<=8) {
     if ($val==7){
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
     } else {
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images/s_".$convColor.".gif' width='16' height='15' ><img src='images/s_vide.gif' width='16' height='15' ><img src='images/s_".$convColor.".gif' width='16' height='15' ></div>";
  }
  } elseif ($val<=10) {
      $ret.= "<div align='center'><img src='images/b5_".$convColor.".gif' width='48' height='37' ></div>";
 
     if ($val==9) {
      $ret.= "<div align='center'><img src='images/b4_".$convColor.".gif' width='48' height='37' ></div>";
  } else {
      $ret.= "<div align='center'><img src='images/b5_".$convColor.".gif' width='48' height='37' ></div>";
  }
  } elseif ($val==11) {
   $ret.= "<div align='center'><img src='images/valet.gif' width='48' height='75' ></div>";
  } elseif ($val==12) {
   $ret.= "<div align='center'><img src='images/dame.gif' width='48' height='75' ></div>";
  } else {
   $ret.= "<div align='center'><img src='images/roi.gif' width='48' height='75' ></div>";
  }
  return $ret;
}
 
//affichage d'une colonne
function afficheCol($table,$numcol){
  if ((count($table)==1 && $table[0][0]==0) || (count($table)==0)) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueRes($numcol);\"><center><div align='center'><img src='images/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images/zvide.gif' border='0'></center>";  
    echo "</td>";  
   
  } else {
   
 echo "<td width=\"71\" valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
    $xx=-1;
 for ($x=0;$x<count($table);$x++){
     echo ($xx>-1?"":"    </td>\n   </tr>\n" );
  $xx=$x;
  echo "   <tr>\n";
  echo "<td>";
  echo conv2carte($table[$x][0],$table[$x][1]);
 }
 if ($xx>-1) {
    //echo"\n";
       echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueCarte(".$table[$xx][0].",".($table[$xx][1]>2?1:0).",".$numcol.",".$table[$xx][1]." );\"><center>".convFigure($table[$xx][0],$table[$xx][1])."</center>\n";
       echo"     <div align=\"right\" >".conv2carte_b($table[$xx][0],$table[$xx][1])."</div></td></tr></table>";
       echo"   </td>";
       echo " </tr>";  
 }
 
    echo "  </table>";  
 //position de light
    echo "<center><img src='images/zvide.gif' name='zonelight".$numcol."' border='0'></center>";
  }
  echo "</td>";
  if ($numcol<8){
   echo "<td width=\"10\">&nbsp;</td>";
  }
}
 
 
function afficheRes($carte,$numcol){
  if ($carte[0]==0) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueRes($numcol);\"><center><div align='center'><img src='images/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images/zvide.gif' border='0'></center>";  
    echo "</td>";
   
  } else {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo conv2carte($carte[0],$carte[1]);
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueCarte(".$carte[0].",".($carte[1]>2?1:0).",".$numcol.",".$carte[1]." );\"><center>".convFigure($carte[0],$carte[1])."</center>\n";
    echo"     <div align=\"right\" >".conv2carte_b($carte[0],$carte[1])."</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images/zvide.gif' name='zonelight".$numcol."' border='0'></center>";  
    echo "</td>";
  }
    if ($numcol==14){
  echo "<td width=\"70\">&nbsp;</td>";  
 } else {
  echo "<td width=\"5\">&nbsp;</td>";  
 }
 
 
}
 
function afficheAs($carte,$numcol){
  if ($carte[0]==0) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueResAs($numcol);\"><center><div align='center'><img src='images/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images/zvide.gif' border='0'></center>";  
    echo "</td>";
   
  } else {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo conv2carte($carte[0],$carte[1]);
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueAs(".$carte[0].",".($carte[1]>2?1:0).",".$numcol.",".$carte[1]." );\"><center>".convFigure($carte[0],$carte[1])."</center>\n";
    echo"     <div align=\"right\" >".conv2carte_b($carte[0],$carte[1])."</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images/zvide.gif' border='0'></center>";  
    echo "</td>";
  }
    if ($numcol<24){
  echo "<td width=\"5\">&nbsp;</td>";  
 }
 
 
}
//---------Main--------------------------
$nbcoup=(trim($nbcoup)==""?0:$nbcoup);
if ($nbcoup[0]==0) {
//initable jeu de carte
$t=iniJeux();
$tres11=array(0,0);
$tres12=array(0,0);
$tres13=array(0,0);
$tres14=array(0,0);
 
$tas21=array(0,0);
$tas22=array(0,0);
$tas23=array(0,0);
$tas24=array(0,0);
 
//melange du jeux
srand((double)microtime()*1000000);
shuffle ($t);
 
//creation des colonnes de cartes
$t_plateau=iniPlateau($t);
$t_col1=rempliCol($t_plateau,1);
$t_col2=rempliCol($t_plateau,2);
$t_col3=rempliCol($t_plateau,3);
$t_col4=rempliCol($t_plateau,4);
$t_col5=rempliCol($t_plateau,5);
$t_col6=rempliCol($t_plateau,6);
$t_col7=rempliCol($t_plateau,7);
$t_col8=rempliCol($t_plateau,8);
 
} else {
 
$t_col1=chargeCol($col1);
$t_col2=chargeCol($col2);
$t_col3=chargeCol($col3);
$t_col4=chargeCol($col4);
$t_col5=chargeCol($col5);
$t_col6=chargeCol($col6);
$t_col7=chargeCol($col7);
$t_col8=chargeCol($col8);
 
$tres11=array(substr($res11,0,(strlen($res11)-1)),substr($res11,-1));
$tres12=array(substr($res12,0,(strlen($res12)-1)),substr($res12,-1));
$tres13=array(substr($res13,0,(strlen($res13)-1)),substr($res13,-1));
$tres14=array(substr($res14,0,(strlen($res14)-1)),substr($res14,-1));
 
$tas21=array(substr($as21,0,(strlen($as21)-1)),substr($as21,-1));
$tas22=array(substr($as22,0,(strlen($as22)-1)),substr($as22,-1));
$tas23=array(substr($as23,0,(strlen($as23)-1)),substr($as23,-1));
$tas24=array(substr($as24,0,(strlen($as24)-1)),substr($as24,-1));
 
 
 
$carte = depile($zone_a);
empile($zone_b,$carte);
}
$nbcoup++;
$col1=dechargeCol($t_col1);
$col2=dechargeCol($t_col2);
$col3=dechargeCol($t_col3);
$col4=dechargeCol($t_col4);
$col5=dechargeCol($t_col5);
$col6=dechargeCol($t_col6);
$col7=dechargeCol($t_col7);
$col8=dechargeCol($t_col8);
 
$res11=$tres11[0].$tres11[1];
$res12=$tres12[0].$tres12[1];
$res13=$tres13[0].$tres13[1];
$res14=$tres14[0].$tres14[1];
 
$as21=$tas21[0].$tas21[1];
$as22=$tas22[0].$tas22[1];
$as23=$tas23[0].$tas23[1];
$as24=$tas24[0].$tas24[1];
                                                                   
?>
 
<html>
<head>
<?php
 include "solitaire.js"
?>
<title>Solitaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
BODY {
 SCROLLBAR-BASE-COLOR: #4A515B;
 SCROLLBAR-ARROW-COLOR: #CCE0FD;
}
SELECT {
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 FONT-SIZE: 11px;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
 
TEXTAREA, .bginput {
 FONT-SIZE: 12px;
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
input {
 FONT-SIZE: 12px;
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
A:link, A:visited, A:active {
 COLOR: #CCE0FD; text-decoration: none; font-weight: bold;
 font-family: Verdana, Arial, Helvetica, sans-serif}
}
A:hover {
 COLOR: FFFFFF; text-decoration: underline; font-weight: bold;
 font-family: Verdana, Arial, Helvetica, sans-serif}
 
 
.info_titre {
        font : bold 18px "Verdana";
        color : #CCE0FD;
}
.info_detail {
  font-size: 11px;
     font-family: Verdana, Arial, sans-serif;
        text-align: justify;
        font-weight : normal;
}
 
td {  font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold;
      COLOR: #000000;}
-->
</style>
</head>
 
<BODY text="efefef" vLink=#FFFFFF aLink=#FFFFFF link=#FFFFFF bgColor=#888C98 leftMargin=0 rightMargin=0 topMargin=0 border="0" marginwidth="0" marginheight="0" >
<p>
<?php
echo "<span class='info_detail'>
<img src='images/logo_freecell_s.gif' align='right' width='50' height='50'>
&nbsp;<a href='index.php'>&lt;&lt; Accueil</a> |
 <a href='solitaire.php'>Nouvelle Partie</a> |
 <a href=\"aide.php\"  target=\"modale\"  OnClick=\"openWindow()\" >rubrique d'aide</a></span><br>";
 
echo "<hr width='100%'><br><br>";
echo "<center><span class='info_detail'><u>Nombre de déplacements</u> :</span><br>";
echo "<span class='info_titre'>".($nbcoup-1)."</span><br></center>";
//echo "<br>nombre de cartes plateau :".count($t_plateau);
?>
</p>
 
   
   
<table width="638" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
<?php
     afficheRes($tres11,11);    
     afficheRes($tres12,12);    
     afficheRes($tres13,13);    
     afficheRes($tres14,14);  
   
     afficheAs($tas21,21);    
     afficheAs($tas22,22);    
     afficheAs($tas23,23);    
     afficheAs($tas24,24);    
     
 
 
?>  
 </tr>
</table><br>
<?php
if ($tas21[0]==13 && $tas22[0]==13 && $tas23[0]==13 && $tas24[0]==13 ) {
    echo "  <table align='center' width=\"638\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "<div align='center'><br><br>";
 echo "<img src='images/fondcase.gif' width='48' height='75' >";
    echo "<span class='info_titre'>FELICITATIONS !!! C'EST GAGNE !!!";
 echo "<img src='images/fondcase.gif' width='48' height='75' >";
 echo "<br><br>&nbsp;</div>\n";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
} else {
?>
<table width="638" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
 
<?php
     afficheCol($t_col1,1);    
     afficheCol($t_col2,2);    
     afficheCol($t_col3,3);    
     afficheCol($t_col4,4);    
     afficheCol($t_col5,5);    
     afficheCol($t_col6,6);    
     afficheCol($t_col7,7);    
     afficheCol($t_col8,8);    
 
 
 
   /*for ($x=1;$x<=8;$x++) {
     afficheCol($t_plateau,$x);    
   }*/
 
?>  
 </tr>
</table>
<center>
<form name='formdata' action='solitaire.php' method='POST'>
  <input type='hidden' name='zone_a' >
  <input type='hidden' name='zone_b' >
   
  <input type='hidden' name='col1' value='<? echo $col1; ?>' >
  <input type='hidden' name='col2' value='<? echo $col2; ?>' >
  <input type='hidden' name='col3' value='<? echo $col3; ?>' >
  <input type='hidden' name='col4' value='<? echo $col4; ?>' >
  <input type='hidden' name='col5' value='<? echo $col5; ?>' >
  <input type='hidden' name='col6' value='<? echo $col6; ?>' >
  <input type='hidden' name='col7' value='<? echo $col7; ?>' >  
  <input type='hidden' name='col8' value='<? echo $col8; ?>' >
 
  <input type='hidden' name='res11' value='<? echo $res11; ?>' >
  <input type='hidden' name='res12' value='<? echo $res12; ?>' >
  <input type='hidden' name='res13' value='<? echo $res13; ?>' >
  <input type='hidden' name='res14' value='<? echo $res14; ?>' >
   
  <input type='hidden' name='as21' value='<? echo $as21; ?>' >
  <input type='hidden' name='as22' value='<? echo $as22; ?>' >
  <input type='hidden' name='as23' value='<? echo $as23; ?>' >
  <input type='hidden' name='as24' value='<? echo $as24; ?>' >
   
   
  <input type='hidden' name='nbcoup' value='<? echo $nbcoup; ?>' >
 
</form>
</center>
<?  
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="100%" align="center" ><hr width="50%"><font color='#FFFFFF'>Copyright &copy; 2002 - Tous droits réservés - <a href='http://evasion.dyndns.info'>evasion.dyndns.info</a> - <a href="mailto:innosyves@yahoo.fr" >Sultan</a></font><br>
<br>
</td></tr></table><br>
</body>
</html>
 
merci de corriger l'erreur
 
amicalement


---------------
sultanb webmaster de evasion
mood
Publicité
Posté le 08-09-2010 à 18:47:01  profilanswer
 

n°2021937
Ydalb
In Crêpes n' Cidre I Trust!
Posté le 08-09-2010 à 19:11:54  profilanswer
 

Heu .. Si tu mettais tout dans des balises [ code] [ / code] ?


---------------
:o
n°2021951
l0g4n
Expert en tout :o
Posté le 08-09-2010 à 19:40:16  profilanswer
 

Accésoirement, il n'y a aucune erreur ligne 569, ton code ne fait QUE 565 lignes...


---------------
Fort et motivé. Sauf parfois.
n°2021956
sultanb
aidons nous svp
Posté le 08-09-2010 à 21:19:18  profilanswer
 

c'est ce qui me fatigue c'est mon code ne fait que 565 lignes donc où se trouve l'erreur alors !!!!!
 
amicalement


---------------
sultanb webmaster de evasion
n°2021967
NewsletTux
&lt;Insérez ici votre vie /&gt;
Posté le 08-09-2010 à 22:53:58  profilanswer
 

peut-être dans une page qui include/require celle-ci ?


---------------
NewsletTux - outil de mailing list en PHP MySQL
n°2021970
WiiDS
20 titres en GC, 0 abandon, 0 DQ
Posté le 08-09-2010 à 23:36:10  profilanswer
 

Je vois vraiment pas comment un code aussi propre peut planter.


---------------
"I can cry like Roger. It's just a shame I can't play like him" - Andy Murray, 2010
n°2022029
rufo
Pas me confondre avec Lycos!
Posté le 09-09-2010 à 11:01:29  profilanswer
 

WiiDS a écrit :

Je vois vraiment pas comment un code aussi propre peut planter.


 
Oui, c'est vraiment un mystère... :whistle: .... :pfff:  


---------------
Astres, outil de help-desk GPL : http://sourceforge.net/projects/astres, ICARE, gestion de conf : http://sourceforge.net/projects/icare, Outil Planeta Calandreta : https://framalibre.org/content/planeta-calandreta
n°2022250
stef_dober​mann
Personne n'est parfait ...
Posté le 10-09-2010 à 10:17:20  profilanswer
 

ligne 402

Code :
  1. include "solitaire.js";

manque le point-virgule, mais l'erreur n'est pas la !


---------------
Tout à commencé par un rêve...
n°2022252
stef_dober​mann
Personne n'est parfait ...
Posté le 10-09-2010 à 10:21:29  profilanswer
 

test chaque fonction indépendamment du reste
à priori cela viens de ton code HTML
en enlevant la partie HTML on obtiens :

Code :
  1. Notice: Undefined variable: nbcoup in test.php on line 322

Message cité 1 fois
Message édité par stef_dobermann le 10-09-2010 à 10:24:41

---------------
Tout à commencé par un rêve...
n°2022288
Pascal le ​nain
Posté le 10-09-2010 à 12:38:33  profilanswer
 

Code :
  1. include "solitaire.js";


 
Il manque aussi des balises <script></script>, ton code javascript est inclu directement dans ton <head>
 
Mais pour ton parse error, je vois pas non plus...

mood
Publicité
Posté le 10-09-2010 à 12:38:33  profilanswer
 

n°2022558
sultanb
aidons nous svp
Posté le 13-09-2010 à 04:56:52  profilanswer
 

stef_dobermann a écrit :

test chaque fonction indépendamment du reste
à priori cela viens de ton code HTML
en enlevant la partie HTML on obtiens :

Code :
  1. Notice: Undefined variable: nbcoup in test.php on line 322



 
jè vu l'erreur j'ai séparer le html du php et à la ligne 323 jè mis $nbcoup=""; dans mon fichier php et jè supprimé $nb=(trim($nbcoup)=""?0:$nbcoup)
merci pour tout votre aide à la prochaine
 
amicalement

n°2022599
stef_dober​mann
Personne n'est parfait ...
Posté le 13-09-2010 à 11:03:16  profilanswer
 

je viens de voir une autre erreur :

Code :
  1. $nb=(trim($nbcoup)=""?0:$nbcoup)

au lieu de faire

Code :
  1. $nb=(trim($nbcoup)==""?0:$nbcoup)


tu fais directement une assignation en ne prenant pas en compte le reste de la ligne, mais vu que tu as fait sauter la ligne, c bon ;)

Message cité 1 fois
Message édité par stef_dobermann le 13-09-2010 à 11:03:41

---------------
Tout à commencé par un rêve...
n°2022757
sultanb
aidons nous svp
Posté le 14-09-2010 à 05:54:13  profilanswer
 

stef_dobermann a écrit :

je viens de voir une autre erreur :

Code :
  1. $nb=(trim($nbcoup)=""?0:$nbcoup)

au lieu de faire

Code :
  1. $nb=(trim($nbcoup)==""?0:$nbcoup)


tu fais directement une assignation en ne prenant pas en compte le reste de la ligne, mais vu que tu as fait sauter la ligne, c bon ;)


 
voici le script final mè je n'arrive encore à jouer car je ne peux pas déplacer mes cartes aidez moi alors svp les amis:
 
<?php
function iniJeux() {
 for ($x=1;$x<=4;$x++) {
   for ($y=1;$y<=13;$y++) {
     $t[]= array($y,$x);
   }
 }
    return $t;
}
 
function iniPlateau($t){
   $cpt=0;
   for ($x=0;$x<count($t);$x++) {
     $cpt++;
  $cpt=($cpt==9?1:$cpt);
  $t_ret[]= array($cpt,$t[$x][0],$t[$x][1]);
   }
   return $t_ret;
}
 
function rempliCol($t,$col) {
   for ($x=0;$x<count($t);$x++) {
     if ($t[$x][0]==$col) {
    $t_ret[]=array($t[$x][1],$t[$x][2]);
  }  
   }
   return $t_ret;
}
 
function chargeCol($col) {
 $t= explode(",", $col);
 //echo "<br><br>chargeCol $col <br>";
 for($x=0;$x<count($t);$x++) {
   $val=substr($t[$x],0,(strlen($t[$x])-1)) ;
   $color=substr($t[$x],-1);
   $t_ret[]= array($val,$color);
   //echo "$val : $color,";
 }
 return $t_ret;
}
 
 
function dechargeCol($t) {
 $ret="";
 for($x=0;$x<count($t);$x++) {
  $ret.=($x>0?",":"" );
  $ret.=trim($t[$x][0]).trim($t[$x][1]);
 }
 $ret=(trim($ret)==""?"00":$ret);
 return $ret;
}
 
function depile($zone) {
 global $t_col1,$t_col2,$t_col3,$t_col4,$t_col5,$t_col6,$t_col7,$t_col8;
 global $tres11,$tres12,$tres13,$tres14;
 switch ($zone) {
  case 1: $t_ret=array_pop($t_col1); break;
  case 2: $t_ret=array_pop($t_col2); break;
  case 3: $t_ret=array_pop($t_col3); break;
  case 4: $t_ret=array_pop($t_col4); break;
  case 5: $t_ret=array_pop($t_col5); break;
  case 6: $t_ret=array_pop($t_col6); break;
  case 7: $t_ret=array_pop($t_col7); break;
  case 8: $t_ret=array_pop($t_col8); break;  
  case 11: $t_ret=$tres11; $tres11=array(0,0); break;  
  case 12: $t_ret=$tres12; $tres12=array(0,0); break;  
  case 13: $t_ret=$tres13; $tres13=array(0,0); break;  
  case 14: $t_ret=$tres14; $tres14=array(0,0); break;  
     
 }
 return $t_ret;
}
 
function empile($zone,$carte) {
 global $t_col1,$t_col2,$t_col3,$t_col4,$t_col5,$t_col6,$t_col7,$t_col8;
 global $tres11,$tres12,$tres13,$tres14;
 global $tas21,$tas22,$tas23,$tas24;
 switch ($zone) {
  case 1: $b=($t_col1[0][0]==0?array_pop($t_col1):0);$t_col1[]=$carte; break;
  case 2: $b=($t_col2[0][0]==0?array_pop($t_col2):0);$t_col2[]=$carte; break;
  case 3: $b=($t_col3[0][0]==0?array_pop($t_col3):0);$t_col3[]=$carte; break;
  case 4: $b=($t_col4[0][0]==0?array_pop($t_col4):0);$t_col4[]=$carte; break;
  case 5: $b=($t_col5[0][0]==0?array_pop($t_col5):0);$t_col5[]=$carte; break;
  case 6: $b=($t_col6[0][0]==0?array_pop($t_col6):0);$t_col6[]=$carte; break;
  case 7: $b=($t_col7[0][0]==0?array_pop($t_col7):0);$t_col7[]=$carte; break;
  case 8: $b=($t_col8[0][0]==0?array_pop($t_col8):0);$t_col8[]=$carte; break;
  case 11 : $tres11=$carte; break;  
  case 12 : $tres12=$carte;  break;
  case 13 : $tres13=$carte;  break;
  case 14 : $tres14=$carte;  break;
 
  case 21 : $tas21=$carte;  break;
  case 22 : $tas22=$carte;  break;
  case 23 : $tas23=$carte;  break;
  case 24 : $tas24=$carte;  break;
 }
}
//convertisseur graphique des valeurs du tableau
function conv2carte($val,$color){
  if ($val==11) {$convVal="V";}
  elseif ($val==12) {$convVal="D";}
  elseif ($val==13) {$convVal="R";}
  elseif ($val==1) {$convVal="A";}
  else {$convVal=$val;}
   
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  if ($color>=3) {$debfont="<font color=\"#FF0000\">";  $finfont="</font>";}
  else           {$debfont="";  $finfont="";}
   
  return $debfont."&nbsp;".$convVal." ".$finfont."<img src=\"images1/".$convColor.".gif\" width=\"11\" height=\"11\">";  
   
}
function conv2carte_b($val,$color){
  if ($val==11) {$convVal="V";}
  elseif ($val==12) {$convVal="D";}
  elseif ($val==13) {$convVal="R";}
  elseif ($val==1) {$convVal="A";}
  else {$convVal=$val;}
   
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  if ($color>=3) {$debfont="<font color=\"#FF0000\">";  $finfont="</font>";}
  else           {$debfont="";  $finfont="";}
   
  return "<img src=\"images1/".$convColor.".gif\" width=\"11\" height=\"11\">".$debfont." ".$convVal."&nbsp;".$finfont;  
   
}
 
function convFigure($val,$color){
  if ($color==1) {$convColor="pique";}
  elseif ($color==2) {$convColor="trefle";}
  elseif ($color==3) {$convColor="coeur";}
  else {$convColor="carreau";}
   
  $ret="";
  if ($val<=6) {
     if ($val==1) {
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";    
  } elseif($val==2){
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
  } elseif($val==3) {
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
  } elseif($val==4){
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";    
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
  } elseif($val==5){
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
  } else {
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
   $ret.= "<div align='center'><img src='images1/m_".$convColor.".gif' width='16' height='25' ><img src='images1/m_vide.gif' width='16' height='25' ><img src='images1/m_".$convColor.".gif' width='16' height='25' ></div>";
  }  
  } elseif ($val<=8) {
     if ($val==7){
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
     } else {
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ></div>";
   $ret.= "<div align='center'><img src='images1/s_".$convColor.".gif' width='16' height='15' ><img src='images1/s_vide.gif' width='16' height='15' ><img src='images1/s_".$convColor.".gif' width='16' height='15' ></div>";
  }
  } elseif ($val<=10) {
      $ret.= "<div align='center'><img src='images1/b5_".$convColor.".gif' width='48' height='37' ></div>";
 
     if ($val==9) {
      $ret.= "<div align='center'><img src='images1/b4_".$convColor.".gif' width='48' height='37' ></div>";
  } else {
      $ret.= "<div align='center'><img src='images1/b5_".$convColor.".gif' width='48' height='37' ></div>";
  }
  } elseif ($val==11) {
   $ret.= "<div align='center'><img src='images1/valet.gif' width='48' height='75' ></div>";
  } elseif ($val==12) {
   $ret.= "<div align='center'><img src='images1/dame.gif' width='48' height='75' ></div>";
  } else {
   $ret.= "<div align='center'><img src='images1/roi.gif' width='48' height='75' ></div>";
  }
  return $ret;
}
 
//affichage d'une colonne
function afficheCol($table,$numcol){
  if ((count($table)==1 && $table[0][0]==0) || (count($table)==0)) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueRes($numcol);\"><center><div align='center'><img src='images1/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images1/zvide.gif' border='0'></center>";  
    echo "</td>";  
   
  } else {
   
 echo "<td width=\"71\" valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
    $xx=-1;
 for ($x=0;$x<count($table);$x++){
     echo ($xx>-1?"":"    </td>\n   </tr>\n" );
  $xx=$x;
  echo "   <tr>\n";
  echo "<td>";
  echo conv2carte($table[$x][0],$table[$x][1]);
 }
 if ($xx>-1) {
    //echo"\n";
       echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueCarte(".$table[$xx][0].",".($table[$xx][1]>2?1:0).",".$numcol.",".$table[$xx][1]." );\"><center>".convFigure($table[$xx][0],$table[$xx][1])."</center>\n";
       echo"     <div align=\"right\" >".conv2carte_b($table[$xx][0],$table[$xx][1])."</div></td></tr></table>";
       echo"   </td>";
       echo " </tr>";  
 }
 
    echo "  </table>";  
 //position de light
    echo "<center><img src='images1/zvide.gif' name='zonelight".$numcol."' border='0'></center>";
  }
  echo "</td>";
  if ($numcol<8){
   echo "<td width=\"10\">&nbsp;</td>";
  }
}
 
 
function afficheRes($carte,$numcol){
  if ($carte[0]==0) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueRes($numcol);\"><center><div align='center'><img src='images1/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images1/zvide.gif' border='0'></center>";  
    echo "</td>";
   
  } else {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo conv2carte($carte[0],$carte[1]);
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueCarte(".$carte[0].",".($carte[1]>2?1:0).",".$numcol.",".$carte[1]." );\"><center>".convFigure($carte[0],$carte[1])."</center>\n";
    echo"     <div align=\"right\" >".conv2carte_b($carte[0],$carte[1])."</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images1/zvide.gif' name='zonelight".$numcol."' border='0'></center>";  
    echo "</td>";
  }
    if ($numcol==14){
  echo "<td width=\"70\">&nbsp;</td>";  
 } else {
  echo "<td width=\"5\">&nbsp;</td>";  
 }
 
 
}
 
function afficheAs($carte,$numcol){
  if ($carte[0]==0) {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "&nbsp;";
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueResAs($numcol);\"><center><div align='center'><img src='images1/fondcase.gif' width='48' height='75' ></div></center>\n";
    echo"     <div align=\"right\" >&nbsp;</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images1/zvide.gif' border='0'></center>";  
    echo "</td>";
   
  } else {
    echo "<td width=\"71\"  valign=\"top\">\n";  
    echo "  <table width=\"71\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo conv2carte($carte[0],$carte[1]);
    echo"     <table align='center' width='100%'><tr><td width='100%' onclick=\"marqueAs(".$carte[0].",".($carte[1]>2?1:0).",".$numcol.",".$carte[1]." );\"><center>".convFigure($carte[0],$carte[1])."</center>\n";
    echo"     <div align=\"right\" >".conv2carte_b($carte[0],$carte[1])."</div></td></tr></table>";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
    echo "<center><img src='images1/zvide.gif' border='0'></center>";  
    echo "</td>";
  }
    if ($numcol<24){
  echo "<td width=\"5\">&nbsp;</td>";  
 }
 
 
}
//---------Main--------------------------
$nbcoup="";
if($nbcoup==0){
//initable jeu de carte
$t=iniJeux();
$tres11=array(0,0);
$tres12=array(0,0);
$tres13=array(0,0);
$tres14=array(0,0);
 
$tas21=array(0,0);
$tas22=array(0,0);
$tas23=array(0,0);
$tas24=array(0,0);
 
//melange du jeux
srand((double)microtime()*1000000);
shuffle ($t);
 
//creation des colonnes de cartes
$t_plateau=iniPlateau($t);
$t_col1=rempliCol($t_plateau,1);
$t_col2=rempliCol($t_plateau,2);
$t_col3=rempliCol($t_plateau,3);
$t_col4=rempliCol($t_plateau,4);
$t_col5=rempliCol($t_plateau,5);
$t_col6=rempliCol($t_plateau,6);
$t_col7=rempliCol($t_plateau,7);
$t_col8=rempliCol($t_plateau,8);
 
}
else{
 
$t_col1=chargeCol($col1);
$t_col2=chargeCol($col2);
$t_col3=chargeCol($col3);
$t_col4=chargeCol($col4);
$t_col5=chargeCol($col5);
$t_col6=chargeCol($col6);
$t_col7=chargeCol($col7);
$t_col8=chargeCol($col8);
 
$tres11=array(substr($res11,0,(strlen($res11)-1)),substr($res11,-1));
$tres12=array(substr($res12,0,(strlen($res12)-1)),substr($res12,-1));
$tres13=array(substr($res13,0,(strlen($res13)-1)),substr($res13,-1));
$tres14=array(substr($res14,0,(strlen($res14)-1)),substr($res14,-1));
 
$tas21=array(substr($as21,0,(strlen($as21)-1)),substr($as21,-1));
$tas22=array(substr($as22,0,(strlen($as22)-1)),substr($as22,-1));
$tas23=array(substr($as23,0,(strlen($as23)-1)),substr($as23,-1));
$tas24=array(substr($as24,0,(strlen($as24)-1)),substr($as24,-1));
 
 
 
$carte = depile($zone_a);
empile($zone_b,$carte);
}
$nbcoup++;
$col1=dechargeCol($t_col1);
$col2=dechargeCol($t_col2);
$col3=dechargeCol($t_col3);
$col4=dechargeCol($t_col4);
$col5=dechargeCol($t_col5);
$col6=dechargeCol($t_col6);
$col7=dechargeCol($t_col7);
$col8=dechargeCol($t_col8);
 
$res11=$tres11[0].$tres11[1];
$res12=$tres12[0].$tres12[1];
$res13=$tres13[0].$tres13[1];
$res14=$tres14[0].$tres14[1];
 
$as21=$tas21[0].$tas21[1];
$as22=$tas22[0].$tas22[1];
$as23=$tas23[0].$tas23[1];
$as24=$tas24[0].$tas24[1];
                                                                   
?>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title>Solitaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<script language="text/javascript">
<!--
var click1_val=0;
var click1_couleur=0;
var click1_zone=0;
var click1_signe="";
var click2_val=0;
var click2_couleur=0;
var click2_zone=0;
var click2_signe="";
 
var nbclick=0;
 
function marqueCarte(w_val,w_color,w_zone,w_signe) {
 nbclick++;
 if (nbclick==1) {
   click1_val=w_val;
   click1_couleur=w_color;
   click1_zone=w_zone;
   click1_signe=w_signe;
   document.formdata.zone_a.value=click1_val;
    eval('document.zonelight'+w_zone).src="images1/zlight.gif";
       
 } else {  
   nbclick=0;
   eval('document.zonelight'+click1_zone).src="images1/zvide.gif";
 
   if (click1_zone!=w_zone && w_zone!=11 && w_zone!=12 && w_zone!=13 && w_zone!=14 ) {    
     if ((w_val==(click1_val+1)) && (click1_couleur!=w_color)) {
      document.formdata.zone_a.value=click1_zone;
      document.formdata.zone_b.value=w_zone;
 
   document.formdata.submit();  
   //alert("déplacement autorise" );
  } else {
   alert("Deplacement non autorisé." );
  }  
   }  
 }
 
}
 
function marqueAs(w_val,w_color,w_zone,w_signe) {
 if (nbclick==1) {
   nbclick=0;
   eval('document.zonelight'+click1_zone).src="images1/zvide.gif";
 
  if (click1_val==(w_val+1) && click1_signe==w_signe) {
      document.formdata.zone_a.value=click1_zone;
      document.formdata.zone_b.value=w_zone;
     document.formdata.submit();  
   
  } else {
   alert("Vous devez empiler les couleurs de l'As au Roi." );
   
  }
   
 }
 
}
 
function marqueRes(w_zone) {
 if (nbclick==1) {
      document.formdata.zone_a.value=click1_zone;
      document.formdata.zone_b.value=w_zone;
     document.formdata.submit();  
 
 }
}
 
function marqueResAs(w_zone) {
 if (nbclick==1) {  
   nbclick=0;
   eval('document.zonelight'+click1_zone).src="images1/zvide.gif";
 
   if (click1_val==1){
      document.formdata.zone_a.value=click1_zone;
      document.formdata.zone_b.value=w_zone;
     document.formdata.submit();
   } else {
   alert("Vous devez commencer par les As." );
   
   }
 }
 
}
-->
</script>
<script language="text/javascript">
<!--
if (navigator.appVersion.substring(0,1)>=3)
{
imgvide=new Image;
imgvide.src='images1/zvide.gif';
imglight=new Image;
imglight.src='images1/zlight.gif';
}
 
function openWindow(){
popupWin = window.open('', 'modale', 'scrollbars=yes,toolbar=no,resizable=no,width=710,height=500')
}
-->
</script>
 
<style>
body {
 SCROLLBAR-BASE-COLOR: #4A515B;
 SCROLLBAR-ARROW-COLOR: #CCE0FD;
}
SELECT {
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 FONT-SIZE: 11px;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
 
TEXTAREA, .bginput {
 FONT-SIZE: 12px;
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
input {
 FONT-SIZE: 12px;
 FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
 COLOR: #CCE0FD;
 BACKGROUND-COLOR: #4A4E55
}
a:link, a:visited, a:active {
 COLOR: #CCE0FD; text-decoration: none; font-weight: bold;
 font-family: Verdana, Arial, Helvetica, sans-serif}
}
a:hover {
 COLOR: FFFFFF; text-decoration: underline; font-weight: bold;
 font-family: Verdana, Arial, Helvetica, sans-serif}
 
 
.info_titre {
        font : bold 18px "Verdana";
        color : #CCE0FD;
}
.info_detail {
  font-size: 11px;
     font-family: Verdana, Arial, sans-serif;
        text-align: justify;
        font-weight : normal;
}
 
td {  font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold;
      COLOR: #000000;}
-->
</style>
</head>
 
<body text="efefef" vLink=#FFFFFF aLink=#FFFFFF link=#FFFFFF bgColor=#888C98 leftMargin=0 rightMargin=0 topMargin=0 border="0" marginwidth="0" marginheight="0" >
<p>
<?php
echo "<span class='info_detail'>
<img src='images1/logo_freecell_s.gif' align='right' width='50' height='50'>
&nbsp;<a href='index.php'>&lt;&lt; Accueil</a> |
 <a href='solitaire.php'>Nouvelle Partie</a> |
 <a href=\"aide.php\"  target=\"modale\"  OnClick=\"openWindow()\" >rubrique d'aide</a></span><br>";
 
echo "<hr width='100%'><br><br>";
echo "<center><span class='info_detail'><u>Nombre de déplacements</u> :</span><br>";
echo "<span class='info_titre'>".($nbcoup-1)."</span><br></center>";
//echo "<br>nombre de cartes plateau :".count($t_plateau);
?>
</p>
 
   
   
<table width="638" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
<?php
     afficheRes($tres11,11);    
     afficheRes($tres12,12);    
     afficheRes($tres13,13);    
     afficheRes($tres14,14);  
   
     afficheAs($tas21,21);    
     afficheAs($tas22,22);    
     afficheAs($tas23,23);    
     afficheAs($tas24,24);    
     
 
 
?>  
 </tr>
</table><br>
<?php
if ($tas21[0]==13 && $tas22[0]==13 && $tas23[0]==13 && $tas24[0]==13 ) {
    echo "  <table align='center' width=\"638\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#5D7BA6\" bordercolor=\"#000000\">\n";
 echo "   <tr>\n";
 echo "    <td>";
 echo "<div align='center'><br><br>";
 echo "<img src='images1/fondcase.gif' width='48' height='75' >";
    echo "<span class='info_titre'>FELICITATIONS !!! C'EST GAGNE !!!";
 echo "<img src='images1/fondcase.gif' width='48' height='75' >";
 echo "<br><br>&nbsp;</div>\n";
    echo"   </td>";
    echo " </tr>";
    echo "  </table>";
} else {
?>
    <table width="638" border="0" cellspacing="0" cellpadding="0" align="center">
     <tr>
<?php
     
     afficheCol($t_col1,1);    
     afficheCol($t_col2,2);    
     afficheCol($t_col3,3);    
     afficheCol($t_col4,4);    
     afficheCol($t_col5,5);    
     afficheCol($t_col6,6);    
     afficheCol($t_col7,7);    
     afficheCol($t_col8,8);    
   
 
 
   /*for ($x=1;$x<=8;$x++) {
     afficheCol($t_plateau,$x);    
   }*/
     
 ?>
    </tr>
    </table>
 
<center>
<form name='formdata' action='solitaire.php' method='post'>
  <input type='hidden' name='zone_a' />
  <input type='hidden' name='zone_b' />
   
  <input type='hidden' name='col1' value='<?php echo $col1; ?>' />
  <input type='hidden' name='col2' value='<?php echo $col2; ?>' />
  <input type='hidden' name='col3' value='<?php echo $col3; ?>' />
  <input type='hidden' name='col4' value='<?php echo $col4; ?>' />
  <input type='hidden' name='col5' value='<?php echo $col5; ?>' />
  <input type='hidden' name='col6' value='<?php echo $col6; ?>' />
  <input type='hidden' name='col7' value='<?php echo $col7; ?>' />  
  <input type='hidden' name='col8' value='<?php echo $col8; ?>' />
 
  <input type='hidden' name='res11' value='<?php echo $res11; ?>' />
  <input type='hidden' name='res12' value='<?php echo $res12; ?>' />
  <input type='hidden' name='res13' value='<?php echo $res13; ?>' />
  <input type='hidden' name='res14' value='<?php echo $res14; ?>' />
   
  <input type='hidden' name='as21' value='<?php echo $as21; ?>' />
  <input type='hidden' name='as22' value='<?php echo $as22; ?>' />
  <input type='hidden' name='as23' value='<?php echo $as23; ?>' />
  <input type='hidden' name='as24' value='<?php echo $as24; ?>' />
   
   
  <input type='hidden' name='nbcoup' value='<?php echo $nbcoup; ?>' />
 
</form>
</center>
<?php
}
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td width="100%" align="center" ><hr width="50%"><font color='#FFFFFF'>Copyright &copy; 2010 - Tous droits réservés - <a href='http://www.evasion.net'>evasion.net</a> - <a href="mailto:innosyves@yahoo.fr" >Sultan</a></font><br>
<br>
</td>
</tr>
</table>
</body>
</html>
 
je dois cliquer sur une carte pour la déplacer mais kan je le fais il y a aucun effet alors peut-être que j'ai oublié d'ajouter un code je ne sais pas aidez moi svp
 
amicalement

n°2022778
stef_dober​mann
Personne n'est parfait ...
Posté le 14-09-2010 à 10:00:43  profilanswer
 

cherche drag & drop en javascript


---------------
Tout à commencé par un rêve...
n°2022782
rufo
Pas me confondre avec Lycos!
Posté le 14-09-2010 à 10:02:06  profilanswer
 

La balise code!!!


---------------
Astres, outil de help-desk GPL : http://sourceforge.net/projects/astres, ICARE, gestion de conf : http://sourceforge.net/projects/icare, Outil Planeta Calandreta : https://framalibre.org/content/planeta-calandreta
n°2022956
l0g4n
Expert en tout :o
Posté le 14-09-2010 à 20:29:34  profilanswer
 

Je crois que t'a oublié la base :
Apprendre au lieu de faire du copier/coller...


---------------
Fort et motivé. Sauf parfois.

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  script de jeu solitaire

 

Sujets relatifs
Créer une classe héritée en Action scriptscript php qui envoie le mot de passe et l'identifiant dans l'email
Script ou template vidéosCherche volontaires pour tester l'évolution majeure d'un script
Problème Script AS3 FlashTemplate ou script siteweb perso
Script et FlagsScript 3dsmax
Cherche script livre d'or et curseur 
Plus de sujets relatifs à : script de jeu solitaire


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR