Exemplo n.º 1
0
        /// <summary>
        /// Compare with other Capture options.
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public int CompareTo(object o)
        {
            CaptureData a = this;
            CaptureData b = (CaptureData)o;

            return(b.Points.Count - a.Points.Count);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs the opponent pieces capture
        /// </summary>
        /// <param name="captureData"></param>
        public void Capture(CaptureData captureData)
        {
            if (captureData == null)
            {
                return;
            }

            //move piece to end position
            CellData activePiece = GetPiece(captureData.Points[0]);

            activePiece.Pos = captureData.Points.Last();
            activePiece.CompleteMove();

            foreach (var point in captureData.Points)
            {
                if (ShouldCoronate(point, Player.Black))
                {
                    //let's do a Coronation
                    activePiece.Type = PieceType.King;
                }
            }

            //remove captured pieces
            foreach (var takenPoint in captureData.TakenPoints)
            {
                RemovePiece(takenPoint);
            }

            UpdateCapturesList();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Highlights potential capture
 /// </summary>
 /// <param name="captureData"></param>
 public void HighlightCapture(CaptureData captureData)
 {
     ClearHighlights();
     if (captureData != null)
     {
         AddHighlight(captureData.Points);
     }
 }