public function play($player, $move)
    {
        if (!$this->isPlayerTurn($player)) {
            throw new AwaleException('Not your turn.');
        }

        if (0 === $this->grid[$player]['seeds'][$move]) {
            throw new AwaleException('This container is empty.');
        }

        $this->checkMustFeedOpponentRule($player, $move);

        $this
            ->move($player, $move)
            ->setLastMove(array(
                'player' => $player,
                'move' => $move,
            ))
            ->changePlayerTurn()
        ;

        if (!$this->hasSeeds(1 - $this->currentPlayer) && !$this->canFeedOpponent($this->currentPlayer)) {
            $this->storeRemainingSeeds($this->currentPlayer);
        }

        return $this;
    }
public function play($player, $move)
    {
        if (!$this->isPlayerTurn($player)) {
            throw new AwaleException('Not your turn.');
        }

        if (0 === $this->grid[$player]['seeds'][$move]) {
            throw new AwaleException('This container is empty.');
        }

        $this->checkMustFeedOpponentRule($player, $move);

        $this
            ->move($player, $move)
            ->setLastMove(array(
                'player' => $player,
                'move' => $move,
            ))
            ->changePlayerTurn()
        ;

        if (!$this->hasSeeds(1 - $this->currentPlayer) && !$this->canFeedOpponent($this->currentPlayer)) {
            $this->storeRemainingSeeds($this->currentPlayer);
        }

        return $this;
    }
public function play ( $ player , $ move ) { if ( ! $ this -> isPlayerTurn ( $ player ) ) { throw new AwaleException ( 'Not your turn.' ) ; } if ( 0 === $ this -> grid [ $ player ] [ 'seeds' ] [ $ move ] ) { throw new AwaleException ( 'This container is empty.' ) ; } $ this -> checkMustFeedOpponentRule ( $ player , $ move ) ; $ this -> move ( $ player , $ move ) -> setLastMove ( array ( 'player' => $ player , 'move' => $ move , ) ) -> changePlayerTurn ( ) ; if ( ! $ this -> hasSeeds ( 1 - $ this -> currentPlayer ) && ! $ this -> canFeedOpponent ( $ this -> currentPlayer ) ) { $ this -> storeRemainingSeeds ( $ this -> currentPlayer ) ; } return $ this ; }
Play a turn, check current player turn.

@param int $player
@param int $move

@return self

@throws AwaleException on invalid move.
Play a turn check current player turn .