This commit is contained in:
Gnieark 2016-06-15 00:51:04 +02:00
parent f86bab3ddb
commit f6cade5fe3
2 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$y][$i];
}
if(strpos($searchValue,$line) !== false ){
return 42;
return 200;
}
//verticaly
@ -38,7 +38,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
}
//echo $line."p".$searchValue." ".strpos($searchValue,$line)."|\n";
if(strpos($searchValue,$line) !== false){
return 42;
return 200;
}
@ -57,7 +57,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$jy][$jx];
}
if(strpos($searchValue,$line) !== false ){
return 42;
return 200;
}
//diagonal /
$b = $y - $colToPlay;
@ -74,7 +74,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
$line.=$newBoard[$jy][$jx];
}
if(strpos($searchValue,$line) !== false){
return 42;
return 200;
}
//if grid is full
@ -89,7 +89,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
return 0;
}
if($depth < 7){
if($depth < 6){
//CO
if(($depth % 2) == 0){
return better_col($newBoard,$opponent,$me,$depth + 1) - $depth;

View File

@ -170,7 +170,7 @@ switch($params['action']){
//diagonales \
$diagStr="";
for($x=0 , $y=$k isset($params['board'][$y][$x]); $x++, $y--){
for($x=0 , $y=$k; isset($params['board'][$y][$x]); $x++, $y--){
$diagStr.=$params['board'][$y][$x];
}
if(can_win($diagStr,$params['you']) !== false){
@ -194,7 +194,7 @@ switch($params['action']){
$colAvailable=array();
//dont play on full colomns
for($i=0;$i<7;$i++){
if(($grid[5][$i] == "+") OR ($grid[5][$i] == "_")){
if(($params['board'][5][$i] == "+") OR ($params['board'][5][$i] == "_")){
$colAvailable[]=$i;
}
}