public function updateGame($x, $y, $player)
    {
        if (!in_array($player, array(1,2))) {
            throw new PlayerNotFoundException($player);
        }

        if ($this->last_player === $player) {
            throw new PlayerRepeatGameException($player);
        }

        if (!is_null($this->board[$x][$y])) {
            throw new MoveAlreadyDoneException($x, $y, $this->board[$x][$y]);
        }

        $this->last_player = $player;
        $this->board[$x][$y] = $player;

        $this->display();
    }
public function updateGame($x, $y, $player)
    {
        if (!in_array($player, array(1,2))) {
            throw new PlayerNotFoundException($player);
        }

        if ($this->last_player === $player) {
            throw new PlayerRepeatGameException($player);
        }

        if (!is_null($this->board[$x][$y])) {
            throw new MoveAlreadyDoneException($x, $y, $this->board[$x][$y]);
        }

        $this->last_player = $player;
        $this->board[$x][$y] = $player;

        $this->display();
    }
public function updateGame ( $ x , $ y , $ player ) { if ( ! in_array ( $ player , array ( 1 , 2 ) ) ) { throw new PlayerNotFoundException ( $ player ) ; } if ( $ this -> last_player === $ player ) { throw new PlayerRepeatGameException ( $ player ) ; } if ( ! is_null ( $ this -> board [ $ x ] [ $ y ] ) ) { throw new MoveAlreadyDoneException ( $ x , $ y , $ this -> board [ $ x ] [ $ y ] ) ; } $ this -> last_player = $ player ; $ this -> board [ $ x ] [ $ y ] = $ player ; $ this -> display ( ) ; }
Update the board status and repaint the board

@param int $x
@param int $y
@param int $player
Update the board status and repaint the board