From 0066000b6e756b3d10a25f1a9826ae5d39a441f3 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Tue, 31 May 2016 09:36:28 +0200 Subject: [PATCH] plop --- tictactoeJSON.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tictactoeJSON.php b/tictactoeJSON.php index ef0c0e0..7943da6 100644 --- a/tictactoeJSON.php +++ b/tictactoeJSON.php @@ -32,8 +32,12 @@ function score_case($map,$me,$him,$case,$depth=0){ ){ return 10 - $depth; }else{ - $sc=choose_better_cell($newMap,$him,$me,$depth + 1); - return -$sc[1]; + if($depth == 9){ + return 0; + }else{ + $sc=choose_better_cell($newMap,$him,$me,$depth + 1); + return -$sc[1]; + } } } function choose_better_cell($map,$me,$him,$depth=0){ @@ -73,4 +77,4 @@ if(!isset($hisSymbol)){ } -echo choose_better_cell($message['board'],$message['you'], $hisSymbol,9 - $freeCells); \ No newline at end of file +echo '{"play":"'.choose_better_cell($message['board'],$message['you'], $hisSymbol,9 - $freeCells).'"}'; \ No newline at end of file