This commit is contained in:
Gnieark 2016-06-13 21:07:51 +02:00
parent 5a67a17ed7
commit 77e916000d

View File

@ -27,7 +27,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
for ($i=0; $i < 7; $i++){ for ($i=0; $i < 7; $i++){
$line.=$newBoard[$y][$i]; $line.=$newBoard[$y][$i];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line) !== false ){
return 42 - $depth; return 42 - $depth;
} }
@ -36,8 +36,8 @@ function score($board,$me,$opponent,$colToPlay,$depth){
for ($i=0; $i < 6; $i++){ for ($i=0; $i < 6; $i++){
$line.=$newBoard[$i][$colToPlay]; $line.=$newBoard[$i][$colToPlay];
} }
echo $line."p".$searchValue." ".strpos($searchValue,$line)."|\n"; //echo $line."p".$searchValue." ".strpos($searchValue,$line)."|\n";
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line) !== false){
return 42 - $depth; return 42 - $depth;
} }
@ -56,7 +56,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
for($jx = $ix, $jy = $iy; ($jx < 7) && ($jy > -1); $jx++, $jy--){ for($jx = $ix, $jy = $iy; ($jx < 7) && ($jy > -1); $jx++, $jy--){
$line.=$newBoard[$jy][$jx]; $line.=$newBoard[$jy][$jx];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line) !== false ){
return 42 - $depth; return 42 - $depth;
} }
//diagonal / //diagonal /
@ -73,7 +73,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
for ($jx = $ix , $jy = $iy ; ($jx < 7) && ($jy < 6) ; $jx++ , $jy++){ for ($jx = $ix , $jy = $iy ; ($jx < 7) && ($jy < 6) ; $jx++ , $jy++){
$line.=$newBoard[$jy][$jx]; $line.=$newBoard[$jy][$jx];
} }
if(strpos($searchValue,$line)){ if(strpos($searchValue,$line) !== false){
return 42 - $depth; return 42 - $depth;
} }