public override void GenerateThreatened(IBoardState boardState, IBoardState owningPlayerBoardState) { IChessPieceMover cpm = ModelLocator.ChessPieceMover; ThreatenSet.Clear(); ThreatenSet.Add(GenerateThreatenedEast(cpm)); ThreatenSet.Add(GenerateThreatenedWest(cpm)); }
/// <summary> /// Generates all squares that are threatened by this piece for the given boardstate. /// </summary> /// <param name="boardState">Full board state</param> /// <param name="owningPlayerBoardState">Used to ignore this other pieces of the same color.</param> public virtual void GenerateThreatened(IBoardState boardState, IBoardState owningPlayerBoardState) { ThreatenSet.Clear(); GenerateMoves(boardState); GenerateCaptures(boardState, owningPlayerBoardState); ThreatenSet.Add(MoveSet); ThreatenSet.Add(CaptureSet); }
/// <summary> /// Ensure that <see cref="GenerateThreatened(IBoardState, IBoardState)" /> is called before this. /// </summary> /// <param name="position"></param> /// <returns></returns> public bool IsThreateningAt(ChessPosition position) { return(ThreatenSet.Contains(position)); }