This commit is contained in:
Gnieark 2016-06-13 20:41:15 +02:00
parent 4a5633c70c
commit c2c3c1207b

View File

@ -28,7 +28,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$y][$i]; $line.=$newBoard[$y][$i];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line)){
return 42; return 42 - $depth;
} }
//verticaly //verticaly
@ -37,7 +37,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$i][$colToPlay]; $line.=$newBoard[$i][$colToPlay];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line)){
return 42; return 42 - $depth;
} }
@ -56,7 +56,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$jy][$jx]; $line.=$newBoard[$jy][$jx];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line)){
return 42; return 42 - $depth;
} }
//diagonal / //diagonal /
$b = $y - $colToPlay; $b = $y - $colToPlay;
@ -73,7 +73,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$jy][$jx]; $line.=$newBoard[$jy][$jx];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line)){
return 42; return 42 - $depth;
} }
//if grid is full //if grid is full
@ -88,9 +88,8 @@ function score($board,$me,$opponent,$colToPlay,$depth){
return 0; return 0;
} }
if($depth < 5){ if($depth < 6){
return $depth - better_col($newBoard,$opponent,$me,$depth + 1); return better_col($newBoard,$opponent,$me,$depth + 1);
}else{ }else{
return 0; return 0;
} }