From f0c973b573089780bf1fe8253aa8e242f1e605ff Mon Sep 17 00:00:00 2001 From: Gnieark Date: Wed, 15 Jun 2016 17:22:23 +0200 Subject: [PATCH] . --- connectfour.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/connectfour.php b/connectfour.php index 46119f5..dfcec8b 100644 --- a/connectfour.php +++ b/connectfour.php @@ -62,6 +62,25 @@ function can_loose($line,$hisChar){ } return false; +} +function should_opponent_win_if_i_play_at($map,$me,$opponent,$colToPlay){ + //j'ouvre l'a possibilité à l'adversaire de jouer au dessus de mon pion + // est-ce une connerie? + + if(($map[4][$colToPlay] == $me) OR ($map[4][$colToPlay] == $opponent)){ + //top of the grid + return false; + } + + for($y = 0; (($map[$y][$colToPlay] <> "+") && ($map[$y][$colToPlay] <> "-")) && ; $y++){ + } + + $map[$y][$colToPlay] = $me; + + //tester les lignes qui passent pas $y+1,$colToPlay + //to do + + } //replace "" by " ", it will simplify my code. $in=str_replace('""','"-"',file_get_contents('php://input'));