plop
This commit is contained in:
parent
6d1d652156
commit
af4d08b73d
|
@ -42,6 +42,7 @@ function can_win($line,$myChar){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function can_loose($line,$hisChar){
|
function can_loose($line,$hisChar){
|
||||||
|
|
||||||
//je pourrai perdre aux 2 prochains tours de jeu
|
//je pourrai perdre aux 2 prochains tours de jeu
|
||||||
// retourne la place du caractere à remplacer pour éviter ça
|
// retourne la place du caractere à remplacer pour éviter ça
|
||||||
if (strpos($line,"+".$hisChar.$hisChar.$hisChar) !== false ){
|
if (strpos($line,"+".$hisChar.$hisChar.$hisChar) !== false ){
|
||||||
|
@ -174,11 +175,11 @@ switch($params['action']){
|
||||||
$diagStr.=$params['board'][$y][$x];
|
$diagStr.=$params['board'][$y][$x];
|
||||||
}
|
}
|
||||||
if(can_win($diagStr,$params['you']) !== false){
|
if(can_win($diagStr,$params['you']) !== false){
|
||||||
echo '{"play":'.$x.'}';
|
echo '{"play":'.can_win($diagStr,$opponent).'}';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
if (can_loose($diagStr,$opponent) !== false){
|
if (can_loose($diagStr,$opponent) !== false){
|
||||||
$colForNoLose = $x;
|
$colForNoLose = can_loose($diagStr,$opponent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ($k = 3 ; $k < 6 ; $k++){
|
for ($k = 3 ; $k < 6 ; $k++){
|
||||||
|
@ -189,11 +190,11 @@ switch($params['action']){
|
||||||
$diagStr.=$params['board'][$y][$x];
|
$diagStr.=$params['board'][$y][$x];
|
||||||
}
|
}
|
||||||
if(can_win($diagStr,$params['you']) !== false){
|
if(can_win($diagStr,$params['you']) !== false){
|
||||||
echo '{"play":'.$x.'}';
|
echo '{"play":'.can_win($diagStr,$params['you']).'}';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
if (can_loose($diagStr,$opponent) !== false){
|
if (can_loose($diagStr,$opponent) !== false){
|
||||||
$colForNoLose = $x;
|
$colForNoLose = can_loose($diagStr,$opponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user