From 6d1d652156c3827254884845a49deba6655f4c8f Mon Sep 17 00:00:00 2001 From: Gnieark Date: Wed, 15 Jun 2016 13:37:15 +0200 Subject: [PATCH] . --- connectfour.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/connectfour.php b/connectfour.php index 61e92f5..c126446 100644 --- a/connectfour.php +++ b/connectfour.php @@ -115,7 +115,7 @@ switch($params['action']){ } if (can_loose($colStr,$opponent) !== false){ $colForNoLose = $x; - } + } } //horizontales @@ -129,7 +129,7 @@ switch($params['action']){ die; } if (can_loose($lnStr,$opponent) !== false){ - $colForNoLose = can_loose($lnStr,$opponent); + $colForNoLose = can_loose($lnStr,$opponent); } } @@ -145,11 +145,11 @@ switch($params['action']){ $diagStr.=$params['board'][$y][$x]; } if(can_win($diagStr,$params['you']) !== false){ - echo '{"play":'.$x.'}'; + echo '{"play":'.($k + can_win($diagStr,$params['you'])).'}'; die; } if (can_loose($diagStr,$opponent) !== false){ - $colForNoLose = $x; + $colForNoLose = $k + can_loose($diagStr,$opponent); } //diagonale \ @@ -158,11 +158,11 @@ switch($params['action']){ $diagStr.=$params['board'][$y][$x]; } if(can_win($diagStr,$params['you']) !== false){ - echo '{"play":'.$x.'}'; + echo '{"play":'.($k + can_win($diagStr,$params['you'])).'}'; die; } if (can_loose($diagStr,$opponent) !== false){ - $colForNoLose = $x; + $colForNoLose = ($k + can_loose($diagStr,$opponent)); }