 
     /// Returns the moves currently available for the piece at `square`, if any.
     @warn_unused_result
+    private func _movesForPiece(at square: Square, considerHalfmoves flag: Bool) -> [Move] {
+        return _movesBitboardForPiece(at: square, considerHalfmoves: flag).moves(from: square)
+    }
+
+    /// Returns the available moves for the current player.
+    @warn_unused_result
+    private func _availableMoves(considerHalfmoves flag: Bool) -> [Move] {
+        return Array(Square.all.map({ _movesForPiece(at: $0, considerHalfmoves: flag) }).flatten())
+    }
+
+    /// Returns the available moves for the current player.
+    @warn_unused_result
+    public func availableMoves() -> [Move] {
+        return _availableMoves(considerHalfmoves: true)
+    }
+
+    /// Returns the moves bitboard currently available for the piece at `square`, if any.
+    @warn_unused_result
+    public func movesBitboardForPiece(at square: Square) -> Bitboard {
+        return _movesBitboardForPiece(at: square, considerHalfmoves: true)
+    }
+
+    /// Returns the moves currently available for the piece at `square`, if any.
+    @warn_unused_result
     public func movesForPiece(at square: Square) -> [Move] {
-        return movesBitboardForPiece(at: square).moves(from: square)
+        return _movesForPiece(at: square, considerHalfmoves: true)
     }
 
     /// Returns the moves currently available for the piece at `location`, if any.

        return Position(game: self)
    }

    /// Create a game from another.
    private init(game: Game) {
        self._moveHistory    = game._moveHistory

        }
    }

    /// Returns the moves bitboard currently available for the piece at `square`, if any.
    @warn_unused_result
    private func _movesBitboardForPiece(at square: Square, considerHalfmoves: Bool) -> Bitboard {
        if considerHalfmoves && halfmoves >= 100 {
            return 0
        }
        guard let piece = board[square] where piece.color == playerTurn else {
