     /// - throws: `ExecutionError` if no piece exists at `move.start` or if `promotion` is invalid.
     public func execute(uncheckedMove move: Move, @noescape promotion: () -> Piece.Kind) throws {
         try _execute(uncheckedMove: move, promotion: promotion)
+        let piece = board[move.end]!
+        if piece.kind.isPawn && abs(move.rankChange) == 2 {
+            enPassantTarget = Square(file: move.start.file, rank: piece.color.isWhite ? 3 : 6)
+        } else {
+            enPassantTarget = nil
+        }
         if kingIsChecked {
             attackersToKing = 0
         } else {

        self.halfmoves = 0
    }

    /// Creates a chess game with `moves`.
    ///
    /// - parameter moves: The moves to execute.


    #else

    /// An error in position validation.
    public enum PositionError: ErrorType {

        /// Found number other than 1 for king count.
        case WrongKingCount(Color)

        /// King missing for castling right.
        case MissingKing(CastlingRights.Right)

        /// Rook missing for castling right.
        case MissingRook(CastlingRights.Right)

        /// Wrong rank for en passant target.
        case WrongEnPassantTargetRank(Rank)

        /// Non empty en passant target square.
        case NonEmptyEnPassantTarget(Square, Piece)

        /// Pawn missing for previous en passant.
        case MissingEnPassantPawn(Square)

        /// Piece found at start of en passant move.
        case NonEmptyEnPassantSquare(Square, Piece)

    }

    /// An error in move execution.
    ///
    /// Thrown by the `execute(move:promotion:)` method for a `Game` instance.
