Esempio n. 1
0
 internal Figure(FigureColor color, FigureType type, Position position)
 {
     this.color = color;
     this.type = type;
     this.position = position;
     CalculateValidMoves(position);
 }
Esempio n. 2
0
 public Player(string name, FigureColor color, State playerState)
 {
     this.validator = new Validator();
     this.Name = name;
     this.Color = color;
     this.figures = this.GetStarGameFifures();
     this.takenFigures = new List<IFigure>();
     this.PlayerState = playerState;
 }
Esempio n. 3
0
File: Pawn.cs Progetto: Humple/Chess
            public Pawn(FigureColor color)
                : base(color)
            {
                diff = true;

                NeighborsFigures = new Figure[2];
                NeighborsFigures[0] = null;
                NeighborsFigures[1] = null;

                LoadBitmap("pawn");
            }
Esempio n. 4
0
 public FigureChoiceWindow(Point startPosition, FigureColor clr)
 {
     InitializeComponent();
     this.Size = new System.Drawing.Size(2 * sqSize, 2 * sqSize);
     this.Location = startPosition;
     arr = new Figure[4];
     arr[0] = new Queen(clr);
     arr[1] = new Rock(clr);
     arr[2] = new Knight(clr);
     arr[3] = new Bishop(clr);
 }
Esempio n. 5
0
 internal Bishop(FigureColor color, FigureType type, Position position)
     : base(color, type, position)
 {
     switch (color)
     {
         case FigureColor.Black:
             draw = "\u265D";
             break;
         case FigureColor.White:
             draw = "\u2657";
             break;
     }
 }
Esempio n. 6
0
 internal Knight(FigureColor color, FigureType type, Position position)
     : base(color, type, position)
 {
     switch (color)
     {
         case FigureColor.Black:
             draw = "\u265E";
             break;
         case FigureColor.White:
             draw = "\u2658";
             break;
     }
 }
Esempio n. 7
0
        public void ValidateMove(IFigure figure, IBoard board, Move move)
        {
            this.startRow = figure.Color == FigureColor.White ? board.Size - 2 : 1;
            this.oppositeColor = figure.Color == FigureColor.White ? FigureColor.Black : FigureColor.White;
            this.direction = (figure.Color == FigureColor.White) ? -1 : 1;

            if (!this.ValidPLayerMoves(move, board))
            {
                throw new InvalidOperationException(string.Format(GlobalConstants.ExceptionMessege, figure.Type));
            }

            base.ValidateMove(figure, board, move);
        }
Esempio n. 8
0
        private bool CheckCaslte(IFigure figure, IBoard board, Move move, FigureColor color, int row, int col, int startCheck, int endCheck)
        {
            if (figure.Color == color && move.To.Row == row && move.To.Col == col)
            {
                var rook = board.SeeFigureOnPosition(row, 0);

                if (rook.Color == color && rook.IsFirstMove && figure.IsFirstMove)
                {
                    for (int i = startCheck; i < endCheck; i++)
                    {
                        if (board.SeeFigureOnPosition(row, i) != null)
                        {
                            return false;
                        }

                    }

                    return true;
                }
            }

            return false;
        }
Esempio n. 9
0
 public Officer(FigureColor color)
     : base(color, FigureType.Officer)
 {
 }
Esempio n. 10
0
 public Queen(FigureColor color)
     : base(color, FigureType.Queen)
 {
 }
Esempio n. 11
0
 public Bishop(FigureColor color)
     : base(color, FigureType.Bishop)
 {
 }
Esempio n. 12
0
 public Queen(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 13
0
 public Bishop(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 14
0
 public Bishop(FigureColor _color, char symbol)
     : base(_color, symbol)
 {
 }
Esempio n. 15
0
 public Rook(FigureColor color)
     : base(color, FigureType.Rook)
 {
 }
Esempio n. 16
0
 public Knight(FigureColor _color, char  symbol)
     : base(_color, symbol)
 {
 }
Esempio n. 17
0
 /// <summary>
 /// Конструктор слона.
 /// </summary>
 /// <param name="boardState">Доска, на которой будет находиться конь.</param>
 public Bishop(int x, int y, FigureColor color, BoardState boardState) : base(x, y, color, boardState)
 {
 }
Esempio n. 18
0
 public static FigureColor IsOppositeColor(FigureColor curColor)
 {
     return(curColor == FigureColor.BLACK ? FigureColor.WHITE : FigureColor.BLACK);
 }
Esempio n. 19
0
 public Queen(FigureColor color)
     : base(color, FigureType.Queen)
 {
 }
Esempio n. 20
0
 public Pawn(FigureColor color)
     : base(color, FigureType.Pawn)
 {
 }
Esempio n. 21
0
 public Figure(FigureColor color, FigureType type)
 {
     this.color = color;
     this.type = type;
 }
Esempio n. 22
0
 public King(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 23
0
        //add change figure
        public void Add_ChangeFigure(Position pos, Figure figure, FigureColor color)
        {
            string command = NetworkDef.CHANGE + ' ' + pos.X + ' ' + pos.Y
                + ' ' + figure.ToString();

            lock (outCommands)
            {
                outCommands.Enqueue(command);
            }
        }
Esempio n. 24
0
 public BoardTobit(BoardTobit boardMover)
     : this()
 {
     CurrentPlayer = (boardMover.CurrentPlayer == FigureColor.WHITE) ? FigureColor.BLACK : FigureColor.WHITE;
     CopyBoard(boardMover, board);
 }
Esempio n. 25
0
 public Pawn(FigureColor _color, char  symbol)
     : base(_color , symbol)
 {
 }
Esempio n. 26
0
 public bool IsMate(FigureColor color)
 {
     var possible = Enumerable.Range(0, 8).SelectMany(x => Enumerable.Range(0, 8).Select(y => this.Board[x, y]).Where(f => f != null && f.Color == color))
                                        .SelectMany(f => f.GetPossibleMoves()).ToArray();
     return possible.Count() == 0;
 }
Esempio n. 27
0
 public Figure(int x, int y, FigureColor color)
 {
     this.Coordinate[0] = x;
     this.Coordinate[1] = y;
     this.color = color;
 }
Esempio n. 28
0
 internal Knight(IGameInternal game, Point point, FigureColor color)
 {
     base.Init(point, color, game);
 }
Esempio n. 29
0
 public Knight(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 30
0
 public Horse(FigureColor color)
     : base(color, FigureType.Horse)
 {
 }
Esempio n. 31
0
 public Pawn(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 32
0
 public Castle(FigureColor color)
     : base(color, FigureType.Castle)
 {
 }
Esempio n. 33
0
 public Rook(int x, int y, FigureColor color)
     : base(x, y, color)
 {
 }
Esempio n. 34
0
 public King(FigureColor color)
     : base(color, FigureType.King)
 {
 }
Esempio n. 35
0
 public Queen(FigureColor _color, char  symbol)
     : base(_color, symbol)
 {
 }
Esempio n. 36
0
 public Bishop(FigureColor Color) : base(Color)
 {
 }