This commit is contained in:
Gnieark 2016-06-13 20:09:18 +02:00
parent a70e0ec9b4
commit c2b4511300

View File

@ -85,13 +85,16 @@ function score($board,$me,$opponent,$colToPlay,$depth){
}
}
if($full){
echo "full";
return 0;
}
if($depth < 10){
return 0 - better_col($newBoard,$opponent,$me,$depth + 1);
echo "depth";
return $depth - better_col($newBoard,$opponent,$me,$depth + 1);
}else{
echo "zero";
return 0;
}
}
@ -105,10 +108,11 @@ function better_col($board,$me,$opponent,$depth){
if( $sc > $betterScore){
$betterScore = $sc -$depth;
$betterCol = $i;
}
echo $i." ".$sc."\n";
echo $i.":".$sc."|";
}
}
}
echo "\n";
return $betterCol;
}