master
Gnieark 8 years ago
parent a86705bad9
commit 0066000b6e

@ -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']!=="")) OR (($newMap['0-2']==$newMap['1-1'])&&($newMap['1-1']==$newMap['2-0'])&&($newMap['2-0']!==""))
){ ){
return 10 - $depth; return 10 - $depth;
}else{
if($depth == 9){
return 0;
}else{ }else{
$sc=choose_better_cell($newMap,$him,$me,$depth + 1); $sc=choose_better_cell($newMap,$him,$me,$depth + 1);
return -$sc[1]; return -$sc[1];
} }
}
} }
function choose_better_cell($map,$me,$him,$depth=0){ function choose_better_cell($map,$me,$him,$depth=0){
$betterCell=""; $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).'"}';
Loading…
Cancel
Save