.
This commit is contained in:
parent
b376637b9e
commit
9bcbb73036
|
@ -96,11 +96,25 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
function worst_col($board,$me,$opponent,$depth){
|
function worst_col($board,$me,$opponent,$depth){
|
||||||
|
$worstScore= 1000;
|
||||||
|
$worstCol= -1;
|
||||||
|
for( $i = 0; $i < 7; $i++){
|
||||||
|
if($board[5][$i] == "+"){
|
||||||
|
$sc = score($board,$me,$opponent,$i,$depth);
|
||||||
|
if( $sc < $worstScore){
|
||||||
|
$worstScore = $sc -$depth;
|
||||||
|
$worstCol = $i;
|
||||||
|
//echo $i.":".$sc."|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $betterCo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function better_col($board,$me,$opponent,$depth){
|
function better_col($board,$me,$opponent,$depth){
|
||||||
$betterScore= -1000;
|
$betterScore= -1000;
|
||||||
$betterCol= -1;
|
$betterCol= -1;
|
||||||
|
@ -108,7 +122,7 @@ function better_col($board,$me,$opponent,$depth){
|
||||||
if($board[5][$i] == "+"){
|
if($board[5][$i] == "+"){
|
||||||
$sc = score($board,$me,$opponent,$i,$depth);
|
$sc = score($board,$me,$opponent,$i,$depth);
|
||||||
if( $sc > $betterScore){
|
if( $sc > $betterScore){
|
||||||
$betterScore = $sc -$depth;
|
$betterScore = $sc;
|
||||||
$betterCol = $i;
|
$betterCol = $i;
|
||||||
//echo $i.":".$sc."|";
|
//echo $i.":".$sc."|";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user