コード例 #1
0
 // Add a game piece to the stack at this position.
 public void Add(TzaarPiece aPiece)
 {
     this.pieces.Push(aPiece);
 }
コード例 #2
0
        // Add a piece to the specified position.
        public void Add(TzaarPiece aPiece, int col, int row)
        {
            if (!this.IsValidPosition(col, row))
                return;

            board[col][row].Add(aPiece);

            // Count the piece we just added.
            Type t = aPiece.GetType();
            if (aPiece.Color == TzaarColor.WHITE)
            {
                if (t == typeof(TzaarPiece.Tzaar))
                    this.whiteTzaarCount++;
                else if (t == typeof(TzaarPiece.Tzarra))
                    this.whiteTzarraCount++;
                else
                    this.whiteTottCount++;
            }
            else
            {
                if (t == typeof(TzaarPiece.Tzaar))
                    this.blackTzaarCount++;
                else if (t == typeof(TzaarPiece.Tzarra))
                    this.blackTzarraCount++;
                else
                    this.blackTottCount++;
            }
        }