'','0-1' => '','0-2' => '', '1-0' => '','1-1' => '','1-2' => '', '2-0' => '','2-1' => '','2-2' => ''); $end=false; $playerPlayingNow=1; while($end==false){ switch($playerPlayingNow){ case 1: $playerURL=$bots[$bot1]['url']; $playerCHAR='X'; $playerName=$bots[$bot1]['name']; break; case 2: $playerURL=$bots[$bot2]['url']; $playerCHAR='O'; $playerName=$bots[$bot2]['name']; break; default: error(500,"oups"); die; } $playerResponse=get_IA_Response($playerCHAR,$playerURL,$map); //tester la validité de la réponse if((isset($map[$playerResponse])) && ($map[$playerResponse]=="")){ //reponse conforme echo "
".$playerName." joue en ".$playerResponse." la nouvelle grille est
";
$map[$playerResponse]=$playerCHAR;
echo "
'.$map[$j.'-'.$i].' | '; } echo "
".$playerName." ".$playerCHAR." a gagné.
"; $end=true; break; } //tester si toutes les cases ne seraient pas prises $full=true; foreach($map as $char){ if($char==""){ $full=false; break; } } if($full){ echo "Match nul
"; $end=true; break; } //on change de joueur if($playerPlayingNow==1){ $playerPlayingNow=2; }else{ $playerPlayingNow=1; } }else{ echo "".$playerName." a fait une réponse non conforme. Il perd
"; break; } } die; break; default: break; }