.
This commit is contained in:
parent
f86bab3ddb
commit
f6cade5fe3
|
@ -28,7 +28,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
$line.=$newBoard[$y][$i];
|
$line.=$newBoard[$y][$i];
|
||||||
}
|
}
|
||||||
if(strpos($searchValue,$line) !== false ){
|
if(strpos($searchValue,$line) !== false ){
|
||||||
return 42;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
//verticaly
|
//verticaly
|
||||||
|
@ -38,7 +38,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
}
|
}
|
||||||
//echo $line."p".$searchValue." ".strpos($searchValue,$line)."|\n";
|
//echo $line."p".$searchValue." ".strpos($searchValue,$line)."|\n";
|
||||||
if(strpos($searchValue,$line) !== false){
|
if(strpos($searchValue,$line) !== false){
|
||||||
return 42;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
$line.=$newBoard[$jy][$jx];
|
$line.=$newBoard[$jy][$jx];
|
||||||
}
|
}
|
||||||
if(strpos($searchValue,$line) !== false ){
|
if(strpos($searchValue,$line) !== false ){
|
||||||
return 42;
|
return 200;
|
||||||
}
|
}
|
||||||
//diagonal /
|
//diagonal /
|
||||||
$b = $y - $colToPlay;
|
$b = $y - $colToPlay;
|
||||||
|
@ -74,7 +74,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
$line.=$newBoard[$jy][$jx];
|
$line.=$newBoard[$jy][$jx];
|
||||||
}
|
}
|
||||||
if(strpos($searchValue,$line) !== false){
|
if(strpos($searchValue,$line) !== false){
|
||||||
return 42;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if grid is full
|
//if grid is full
|
||||||
|
@ -89,7 +89,7 @@ function score($board,$me,$opponent,$colToPlay,$depth){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($depth < 7){
|
if($depth < 6){
|
||||||
//CO
|
//CO
|
||||||
if(($depth % 2) == 0){
|
if(($depth % 2) == 0){
|
||||||
return better_col($newBoard,$opponent,$me,$depth + 1) - $depth;
|
return better_col($newBoard,$opponent,$me,$depth + 1) - $depth;
|
||||||
|
|
|
@ -170,7 +170,7 @@ switch($params['action']){
|
||||||
|
|
||||||
//diagonales \
|
//diagonales \
|
||||||
$diagStr="";
|
$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];
|
$diagStr.=$params['board'][$y][$x];
|
||||||
}
|
}
|
||||||
if(can_win($diagStr,$params['you']) !== false){
|
if(can_win($diagStr,$params['you']) !== false){
|
||||||
|
@ -194,7 +194,7 @@ switch($params['action']){
|
||||||
$colAvailable=array();
|
$colAvailable=array();
|
||||||
//dont play on full colomns
|
//dont play on full colomns
|
||||||
for($i=0;$i<7;$i++){
|
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;
|
$colAvailable[]=$i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user