         #endif
     }
 
+    /// Returns `true` if `self` can castle for `side`.
+    public func canCastle(for side: Board.Side) -> Bool {
+        #if swift(>=3)
+            return !self.intersection(CastlingRights(side: side)).isEmpty
+        #else
+            return !self.intersect(CastlingRights(side: side)).isEmpty
+        #endif
+    }
+
 }
 
 #if swift(>=3)

        self = color.isWhite ? .white : .black
    }

    #if swift(>=3)

    /// Creates a set of rights from a sequence.

    /// Black castling rights.
    public static let black = CastlingRights(Right.black)

    /// Kingside castling rights.
    public static let kingside = CastlingRights(Right.kingside)

    /// Queenside castling rights.
    public static let queenside = CastlingRights(Right.queenside)

    /// The rights.
    private var _rights: Set<Right>

