|
|
|
@ -31,10 +31,14 @@ function score_case($map,$me,$him,$case,$depth=0){
|
|
|
|
|
OR (($newMap['0-2']==$newMap['1-1'])&&($newMap['1-1']==$newMap['2-0'])&&($newMap['2-0']!==""))
|
|
|
|
|
){
|
|
|
|
|
return 10 - $depth;
|
|
|
|
|
}else{
|
|
|
|
|
if($depth == 9){
|
|
|
|
|
return 0;
|
|
|
|
|
}else{
|
|
|
|
|
$sc=choose_better_cell($newMap,$him,$me,$depth + 1);
|
|
|
|
|
return -$sc[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function choose_better_cell($map,$me,$him,$depth=0){
|
|
|
|
|
$betterCell="";
|
|
|
|
@ -73,4 +77,4 @@ if(!isset($hisSymbol)){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo choose_better_cell($message['board'],$message['you'], $hisSymbol,9 - $freeCells);
|
|
|
|
|
echo '{"play":"'.choose_better_cell($message['board'],$message['you'], $hisSymbol,9 - $freeCells).'"}';
|