Ejemplo n.º 1
0
 public ChessSquare(ChessPiece piece, int row, int column)
 {
     me       = this;
     m_piece  = piece;
     m_row    = row;
     m_column = column;
 }
Ejemplo n.º 2
0
        public override ChessSquare[] getSquares()
        {
            ChessBoard b = ChessBoard.getBoard();

            ChessSquare[] move = new ChessSquare[8];
            if (m_square.getColumn() > 1)
            {
                move[0] = b.getSquare(m_square.getRow(), m_square.getColumn() - 1);
            }
            else
            {
                move[0] = null;
            }
            if (m_square.getColumn() < 8)
            {
                move[1] = b.getSquare(m_square.getRow(), m_square.getColumn() + 1);
            }
            else
            {
                move[1] = null;
            }
            move[2] = b.getSquare(m_square.getRow() - 1, m_square.getColumn() - 1);
            move[3] = b.getSquare(m_square.getRow() - 1, m_square.getColumn() + 1);
            move[4] = b.getSquare(m_square.getRow() + 1, m_square.getColumn() - 1);
            move[5] = b.getSquare(m_square.getRow() + 1, m_square.getColumn() + 1);
            move[6] = b.getSquare(m_square.getRow() + 1, m_square.getColumn());
            move[7] = b.getSquare(m_square.getRow() - 1, m_square.getColumn());

            return(null);
        }
Ejemplo n.º 3
0
 public ChessBoard()
 {
     for (int r = 0; r < 8; r++)
     {
         for (int c = 0; c < 8; c++)
         {
             m_b[r, c] = new ChessSquare(r + 1, c + 1);
             System.Console.WriteLine(m_b[r, c]);
         }
     }
 }
Ejemplo n.º 4
0
 public Bishop(color c, ChessSquare s) : base(piece.eBISHOP, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhiteBishop;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackBishop;
     }
 }
Ejemplo n.º 5
0
 public King(color c, ChessSquare s) : base(piece.eKING, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhiteKing;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackKing;
     }
 }
Ejemplo n.º 6
0
 public Knight(color c, ChessSquare s) : base(piece.eKNIGHT, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhiteKnight;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackKnight;
     }
 }
Ejemplo n.º 7
0
 public Pawn(color c, ChessSquare s) : base(piece.ePAWN, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhitePawn;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackPawn;
     }
 }
Ejemplo n.º 8
0
 public Queen(color c, ChessSquare s) : base(piece.eQUEEN, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhiteQueen;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackQueen;
     }
 }
Ejemplo n.º 9
0
 public Rook(color c, ChessSquare s) : base(piece.eROOK, c, s)
 {
     if (c == color.eWHITE)
     {
         m_image = ChessTime_.Properties.Resources.WhiteRook;
     }
     else
     {
         m_image = ChessTime_.Properties.Resources.BlackRook;
     }
 }
Ejemplo n.º 10
0
        public ChessSquare(string location)
        {
            me = this;
            string column = location.Substring(0, 1);
            string row    = location.Substring(0, 1);

            switch (column)
            {
            case "A":
                m_column = 1;
                break;

            case "B":
                m_column = 2;
                break;

            case "C":
                m_column = 3;
                break;

            case "D":
                m_column = 4;
                break;

            case "E":
                m_column = 5;
                break;

            case "F":
                m_column = 6;
                break;

            case "G":
                m_column = 7;
                break;

            case "H":
                m_column = 8;
                break;
            }

            m_row = int.Parse(row);
        }
Ejemplo n.º 11
0
 public ChessSquare(int row, int column)
 {
     me       = this;
     m_row    = row;
     m_column = column;
 }
Ejemplo n.º 12
0
 public ChessSquare(ChessPiece piece)
 {
     me      = this;
     m_piece = piece;
 }
Ejemplo n.º 13
0
 public ChessPiece(piece unit, color color, ChessSquare s)
 {
     m_square = s;
     s.SetChessPiece(this);
 }